How do I create a new image, not from a file, using Magick Core? It needs to be 50k x 50k. I then need to set the pixels, in blocks of 16x16, and save the file. I have searched this forum, and the website, and not found anything that involves creating an image from scratch - only loading images and modifying them. Be grateful for some simple example code. Thanks.
James
simples of questions
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: simples of questions
Create an image with...
to also set teh top left 16x16 area to red do...
However if ALL 16x16 blocks are solid colors. a better way may be to create your image as a single pixel, and -scale it by 1600%
for example generating a 160x160 image with just the top left corner red
can be create dby creating a 10x10 pixel image with just one pixel red!
create a TXT image file (See http://www.imagemagick.org/Usage/files/#txt )
and call it "pixel_image.txt"
There are hundreds of ways of generating images.
See more in IM Examples, Canvases
http://www.imagemagick.org/Usage/canvas/
Code: Select all
convert -size 50000x50000 xc:black save_image.png
Code: Select all
convert -size 50000x50000 xc:black \
-draw 'fill red -rectangle 0,0 15,15' \
save_image.png
for example generating a 160x160 image with just the top left corner red
can be create dby creating a 10x10 pixel image with just one pixel red!
create a TXT image file (See http://www.imagemagick.org/Usage/files/#txt )
and call it "pixel_image.txt"
Now scale it# ImageMagick pixel enumeration: 10,10,255,rgb
0,0: (255,0,0)
Code: Select all
convert pixel_image.txt -scale 1600% save_image.png
See more in IM Examples, Canvases
http://www.imagemagick.org/Usage/canvas/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: simples of questions
I meant the C Magick Core interface. I just found the Architecture page and read that. What's missing is how to specify what format to save the file in, or rather, what specific version of the format. I want to save 64bit PNG, (RGBA 16bpc).
Thanks
Jamie
Thanks
Jamie
Re: simples of questions
To create a 50k x 50k image canvas use these MagickCore API calls:
Code: Select all
Image *image = AcquireImage( image_info );
if (SetImageExtent( image, 50*1024, 50*1024 ) == MagickFalse )
perror( "somethings wrong" );
Re: simples of questions
How to specify saving 16bpc PNG vs 8bpc? Or float TIFF vs 8bpc TIFF? Or RGBA vs RGB?
Re: simples of questions
Use SetImageDepth() to specify the image depth:
- SetImageDepth( image, 8 );
- SetImageProperty( image, "quantum:format", "floating-point");
- SetImageAlphaChannel( image, ActivateAlphaChannel );