Page 1 of 1

How to add a pixel width to an image.

Posted: Tue Jun 25, 2024 11:53 pm
by matalog
Say I have an open image, is there a way to add a pixel or more to the width of it - To make it one pixel wider, 256x400 instead of 255x400.

Is there a way to copy an image into file to an open image, the open image being bigger than the image to be copied, and copying it will not change the size of the current image resulting in the current image containing the copied image in a corner?

What I am looking to do is be able to use POINT() on all points of the current image +1 on the width and as I am outputting Floyd Steinberg dithering, if the image is only the size it that Copyimage() imports, then I cannot use POINT(x+1,y).

Re: How to add a pixel width to an image.

Posted: Wed Jun 26, 2024 4:51 am
by Demivec
Some pseudo code:
  • Load or create source image.
  • Create new image 1 pixel wider than source image.
  • Draw source image into new image.
  • Save (or use) new image.
  • Free source image if no longer needed.

Re: How to add a pixel width to an image.

Posted: Wed Jun 26, 2024 8:55 am
by matalog
Demivec wrote: Wed Jun 26, 2024 4:51 am Some pseudo code:
  • Load or create source image.
  • Create new image 1 pixel wider than source image.
  • Draw source image into new image.
  • Save (or use) new image.
  • Free source image if no longer needed.
Drawimage(), of course, now wouldn't it be useful if that was in the image index.

Thanks Demivec.

Re: How to add a pixel width to an image.

Posted: Wed Jun 26, 2024 11:19 am
by DarkDragon
matalog wrote: Wed Jun 26, 2024 8:55 am
Demivec wrote: Wed Jun 26, 2024 4:51 am Some pseudo code:
  • Load or create source image.
  • Create new image 1 pixel wider than source image.
  • Draw source image into new image.
  • Save (or use) new image.
  • Free source image if no longer needed.
Drawimage(), of course, now wouldn't it be useful if that was in the image index.

Thanks Demivec.
It's better in the 2D Drawing section, since it's more related to StartDrawing/StopDrawing similar to QPainter in Qt or Canvasses in Android or Graphics in Swing.
https://www.purebasic.com/documentation ... index.html