Problem converting huge images

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
Skaggivara
Posts: 2
Joined: 2011-05-11T02:14:32-07:00
Authentication code: 8675308

Problem converting huge images

Post by Skaggivara »

Hi I am using imagemagick version 6.6.9-1 on macosx snow leopard, Imac core i7, 2.93ghz, 8gb ram.

I am trying to convert a huge png (8bit RGB 86400x43200) to ppm. I can open the png in photoshop, it seems fine. However when I create a ppm file out of the png it seems to be invalid, meaning I cannot open it in photoshop (gives and error).

I use the following command: "convert huge_normal.png huge_normal.ppm"

The file is created, and no error is thrown but I cannot use the resulting file. Is there a size limit on ppm files? Any other issues I should be aware of?

I need ppm files because I am using mmps (http://www.users.globalnet.co.uk/~arcus/mmps/)

Thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem converting huge images

Post by fmw42 »

you may be running out of memory. see http://www.imagemagick.org/Usage/files/#massive
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem converting huge images

Post by magick »

Photoshop may not support all features of PPM. Does the first few lines of the PPM suggest the image remains in 8-bits or is it 16? The max value should be 255 rather than 65535. Can ImageMagick read the PPM. Try
  • identify -verbose image.ppm
Be patient. It may take some time for the command to respond ('cause its so huge).
Skaggivara
Posts: 2
Joined: 2011-05-11T02:14:32-07:00
Authentication code: 8675308

Re: Problem converting huge images

Post by Skaggivara »

Format: PPM (Portable pixmap format (color))
Class: DirectClass
Geometry: 43200x21600+0+0
Resolution: 72x72
Print size: 600x300
Units: Undefined
Type: TrueColor
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 0 (0)
max: 255 (1)
mean: 127.913 (0.501619)
standard deviation: 30.4004 (0.119217)
kurtosis: 5.8757
skewness: -0.0165218
Green:
min: 0 (0)
max: 255 (1)
mean: 126.475 (0.495979)
standard deviation: 30.3162 (0.118887)
kurtosis: 5.29629
skewness: -0.298521
Blue:
min: 96 (0.376471)
max: 255 (1)
mean: 230.418 (0.903602)
standard deviation: 41.3215 (0.162045)
kurtosis: 0.425264
skewness: -1.41602
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 161.602 (0.633733)
standard deviation: 34.4031 (0.134914)
kurtosis: 17.2632
skewness: 2.43846
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 43200x21600+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2011-05-11T16:23:06+02:00
date:modify: 2011-05-11T16:23:06+02:00
signature: 42a7a5da9dee9358e460993b6bd1ecdbdb0c5a283f08b62a02e10d3dcd665db9
Artifacts:
verbose: true
Tainted: False
Filesize: 2.7994GBB
Number pixels: 933.1MB
Pixels per second: 8.966MB
User time: 6.640u
Elapsed time: 1:45.069
Version: ImageMagick 6.6.9-1 2011-05-09 Q16 http://www.imagemagick.org

this is what I get for identify -verbose on a 43200x21600 pixel image converted to ppm from png. Does not look like there is something wrong?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem converting huge images

Post by magick »

ImageMagick is creating the PPM image properly. Photoshop most likely has a bug. Post a URL to you image so we can download it. We'll verify it meets the PPM image specification. If so, the problem lies with Photoshop.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem converting huge images

Post by anthony »

magick wrote:Photoshop may not support all features of PPM. Does the first few lines of the PPM suggest the image remains in 8-bits or is it 16? The max value should be 255 rather than 65535. Can ImageMagick read the PPM. Try
  • identify -verbose image.ppm
Be patient. It may take some time for the command to respond ('cause its so huge).
This will get the info faster...
head -n3 image.ppm
The first four words (generally over 3 lines) is: "P3" or "P6", widith, height, value_range
and the rest is purely image data (generally in raw binary).

However be warned that PPM images can have ANY value_range setting from 1 to 65535. It is not limited to 8 or 16 bit depth quality, though they are typically stored in that range. Imagemagick can only generate PPM images with 8 or 16 bit quality.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
andreaplanet
Posts: 1
Joined: 2011-07-20T11:49:23-07:00
Authentication code: 8675308

Re: Problem converting huge images

Post by andreaplanet »

If the PPM has binary raw values then you can load it in Photoshop using the RAW PlugIN. Rename the file into .RAW then when you open it in Photoshop enter the correct values for size, count (3 for RGB), interleaved checked, and at last you must set the Header to the size of the initial header of the PPM file.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem converting huge images

Post by anthony »

If photoshop allows it (and it should) you should also be allow to gzip the ppm file. The PbmPLus library understand gzipped forms of PPM images directly, and so does ImageMagick (through a different technqiue) However this will not help with a out of memory problem.

PPM images are typically used so that you can design 'streaming' methods of image processing, that have a much smaller memory foot print. However not all image processing can be performed using streaming methods, and in that case images are typically broken up into tiles for processing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply