Minimising disk usage during scaling?
Posted: 2007-06-05T10:24:09-07:00
Using ImageMagick-6.2.8
I have a large (~450MB) compressed TIFF image:
Uncompressed, I believe this would occupy 4,058 x 56,578 x 3 = 688,780,572 bytes.
I'm converting this to a scaled-down progressive RGB JPEG image using the following sequence of MagickWand calls:
During the course of this it creates two ~1.8GB temporary files in my MAGICK_TMPDIR.
I'd imagine the 1.8GB is because my ImageMagick is compiled with 24 bits per channel. However I'm not sure why scaling the image creates any intermediate files, let alone two.
Is there a way I can avoid any disk usage whatsoever, scaling directly from the input file to the output file?
I have a large (~450MB) compressed TIFF image:
Code: Select all
TIFF Directory at offset 0x8
Subfile Type: (0 = 0x0)
Image Width: 4058 Image Length: 56578
Resolution: 300, 300 pixels/inch
Bits/Sample: 8
Compression Scheme: LZW
Photometric Interpretation: RGB color
Date & Time: "2006:05:17 12:16:33"
Software: "Adobe Photoshop CS2 Macintosh"
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 21
Planar Configuration: single image plane
ICC Profile: <present>, 544 bytes
Photoshop Data: <present>, 11178 bytes
RichTIFFIPTC Data: <present>, 2 bytes
Predictor: horizontal differencing 2 (0x2)
I'm converting this to a scaled-down progressive RGB JPEG image using the following sequence of MagickWand calls:
Code: Select all
w = NewMagickWand()
MagickReadImage(w, srcfile)
MagickSetImageFormat(w, "JPEG")
MagickScaleImage(w, 179, 2500)
MagickSetInterlaceScheme(w, MAGICK_PlaneInterlace)
MagickSetCompressionQuality(w, 85)
MagickSetImageColorspace(w, MAGICK_RGBColorspace)
MagickWriteImage(w, dstfile)
DestroyMagickWand(w)
I'd imagine the 1.8GB is because my ImageMagick is compiled with 24 bits per channel. However I'm not sure why scaling the image creates any intermediate files, let alone two.
Is there a way I can avoid any disk usage whatsoever, scaling directly from the input file to the output file?