Resizing Huge Image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
G4XTR

Resizing Huge Image

Post by G4XTR »

Hi Guys,

I need some help; I'm trying to resize images with sizes of ~10GB using the convert -resize command.

The resize value is quite small, so the output file size isn't much different than the original image.

This all works out fine, however, it takes muuuch too long to complete the process; I'm therefore looking for ways to reduce the processing time. Apart from hardware upgrades, what would you recommend among these options:

- Use different File Format for Resizing? (Currently using .jpg, .png for example was much slower)
- Use a different Software for the resizing?
- Mogrify vs Convert?
- Is there a command to join multiple images slices together into 1 single image?
(Original image could be sliced up and resized individually to save memory)

Any help appreciated
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing Huge Image

Post by fmw42 »

try

convert -resize WxH inputimage outputimage

For very large images, see
http://www.imagemagick.org/Usage/files/#massive

For separating the image and then putting it back:

to separate see -crop
http://www.imagemagick.org/Usage/crop/

to join together see either montage or append
http://www.imagemagick.org/Usage/montage/
G4XTR

Re: Resizing Huge Image

Post by G4XTR »

great help. thanks
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resizing Huge Image

Post by anthony »

It may be that the raw image data (from stream) could be filtered to say only output every 4 pixel on every 4th row to cut the image size by 1/16 before reading it into convert!

Actually the JPG library using the -size hint does something very similar. If you large image is JPEG you can just use -size hint yourself. See... the last bit in
http://www.imagemagick.org/Usage/thumbnails/#profiles
just before the next section on "General Thumbnail Creation"

Once you have a smaller easier to manage image, you can then resize normally to the final size.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
G4XTR

Re: Resizing Huge Image

Post by G4XTR »

Thanks Anthony,

If I'm getting this right, your solution would be to read just what is required for the result, thereby stripping it from any useless information to save memory.

Problem in this case is that the initial 200cm+ image needs to be adjusted only by around 1,2 cm, so not much different than the original image size.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resizing Huge Image

Post by anthony »

A lot of resize methods will generaly produce a blury result for very small resizes like that.
Cropping may work a lot better in such a situation. But it depends on just what the image is.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply