altmany / export_fig

A MATLAB toolbox for exporting publication quality figures
BSD 3-Clause "New" or "Revised" License
1.27k stars 368 forks source link

Specify bit depth? #269

Closed hyiltiz closed 5 years ago

hyiltiz commented 5 years ago

There doesn't seem to be any way to specify bit depth. I find myself printing black and white bitmaps quite frequently, and assume using 1-bit depth png files might be considerably smaller than a full 8-bit ones.

altmany commented 5 years ago

I added the new -options parameter to resolve this.

Note that for best compression, you should also use other options such as -q and -gray. See the help section of the latest export_fig version for details.

hyiltiz commented 5 years ago

The journal I am about to submit requires grayscale images to be at least 1200 resolution. But for my 6x4 inch grayscale image, setting -r 1200 for export_fig fails since it would require too much memory (my system has 8G). I can generate at -r 300 or -r 600 and those are always less than 3Mb after successful export, so the final image should be within several orders of magnitude. But I assume it could've taken much less if any preprocessing has been done without rendering the full image first, then based on parameters estimated after the preprocessing, the whole image is written sequentially. Is that something possible to do?

altmany commented 5 years ago

I do not plan to include such an enhancement in the near future.

You can try to save the figure using the saveas or print functions, and then process the resulting screenshot images in an image-processing program.