Page 1 of 1
save binary image
Posted: 2017-01-28T14:33:05-07:00
by bronstein87
trying to save binary image:
Image image;
image.size(Geometry(10000,10000));
image.type(BilevelType);
image.write("D:\\copy_check.tiff");
but after saving file has size 195 MB. Why? After all, if it was converted into a binary, it's size must be about 10000*10000*1bit =10 MB.
Re: save binary image
Posted: 2017-01-28T15:08:40-07:00
by fmw42
What does identify -verbose copy_check.tiff tell you about the resulting image. It may be 8/1 bits or 16/1 bits palette or truecolor.
Try adding depth 1 and compress group4 or fax.
What version of Imagemagick are you using and what OS/platform?
Please always provide your IM version and platform when asking questions.
Re: save binary image
Posted: 2017-01-28T16:06:15-07:00
by bronstein87
fmw42 wrote: ↑2017-01-28T15:08:40-07:00
What does identify -verbose copy_check.tiff tell you about the resulting image. It may be 8/1 bits or 16/1 bits palette or truecolor.
Try adding depth 1 and compress group4 or fax.
What version of Imagemagick are you using and what OS/platform?
Please always provide your IM version and platform when asking questions.
Version:ImageMagick-7.0.4-6-Q16-x86. Platform: Windows 7.
Thank you. image.depth(1) helped. but, there is a new problem. when i'm making bigger image , for example:
Image* image=new Image(Geometry(1,1),"black");
image->type(BilevelType);
image->depth(1);
image->resize(Geometry(35000,35000));
it returns error "unable to extend cache, no space left on device". but it's strange, because this image after resize will have size: 35000*35000*1bit=125 MB , it is not much and i don't understand why it says that there is no enougth space.
Re: save binary image
Posted: 2017-01-28T16:14:35-07:00
by snibgo
35000*35000 is 1225 million pixels. V6 Q16 needs 8 bytes/pixel of memory (I'm not sure about v7). So that is 9.8 GB.
The depth and type is only relevant once the image has been created, and is to be written to file.