How to add a pixel width to an image.

Just starting out? Need help? Post your questions and find answers here.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 305
Joined: Tue Sep 05, 2017 10:07 am

How to add a pixel width to an image.

Post 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).
User avatar
Demivec
Addict
Addict
Posts: 4281
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

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

Post 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.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 305
Joined: Tue Sep 05, 2017 10:07 am

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

Post 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.
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

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

Post 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
bye,
Daniel
Post Reply