I have a large poster as a pdf-file. I need to create a raster image from it (for instance because there seems to be no pdf viewer which allows me to zoom sufficiently to see the contents). So I create a png with:

gs -r12000 -dEPSCrop -dTextAlphaBits=4 -sDEVICE=png16m -sOutputFile=example.png -dBATCH -dNOPAUSE example.pdf

This generates a compact png file, which however expands to many Gb when I open it in an editor like gimp (the original image contains lots of white background which is apparently compressed efficiently by png). On my notebook the picture does not load because of lack of memory.

I tried things like

convert -crop 50000x13000 +repage example.png cropped_%d.png

which is meant to cut the file in chunks small enough to open them. However it fails with an error.

The question is if there is a modification of the convert command or a different command line tool which can cut the picture into chunks without the need to load it in an editor. Maybe it is possible to tell ghostscript to only raster a given part of the image in first place?

  • I did a test with a small photo and the convert command you shared does work. Could you copy and paste the error? if very long maybe post on pastebin? Another thing is to run identify example.png and share the results, that could also give clues. – clarity123 Sep 27 '15 at 21:44
  • 1
    It seems that this does depend also on the available memory. It works on my desktop which has a lot but not on my notebook. In which case it does not exit gracefully but results in various errors. – highsciguy Sep 28 '15 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.