Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
toX_

Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

OS: Debian Sid (Testing)
ImageMagick Version: 6.5.1-0

the ARW-File Format (Sony Alpha RAW File) had changed in the 3rd Quarter of 2008
i'm not able to open any photo with imagemagick lately

error:

Code: Select all

convert: test.arw: unknown field with tag 513 (0x201) encountered. `TIFFReadDirectory' @ tiff.c/TIFFWarnings/526.
convert: test.arw: unknown field with tag 514 (0x202) encountered. `TIFFReadDirectory' @ tiff.c/TIFFWarnings/526.
convert: test.arw: TIFF directory is missing required "ImageLength" field. `MissingRequired' @ tiff.c/TIFFErrors/324.
convert: missing an image filename `123.jpg' @ convert.c/ConvertImageCommand/2775.
additional info:

Code: Select all

root@helios:~# identify -list configure

Path: /usr/lib/ImageMagick-6.5.1/config/configure.xml

Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99
CFLAGS        -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fopenmp -g -O2 -Wall -W -pthread
CONFIGURE     ./configure  '--prefix=/usr' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--with-gs-font-dir=/usr/sh                       are/fonts/type1/gsfonts' '--with-magick-plus-plus' '--with-djvu' '--enable-shared' '--without-dps' '--without-fpx' '--with-perl-option                       s=INSTALLDIRS=vendor' '--x-includes=/usr/include/X11' '--x-libraries=/usr/lib/X11' 'CFLAGS=-g -O2' 'LDFLAGS=' 'CPPFLAGS=' 'CXXFLAGS=-g                        -O2'
COPYRIGHT     Copyright (C) 1999-2009 ImageMagick Studio LLC
CPPFLAGS      -I/usr/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -Wall -W -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     bzlib djvu fontconfig freetype gvc jpeg jp2 lcms lqr openexr png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-g -O2' 'CPPFLAGS=' 'LDFLAGS=' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autot                       race=no --with-dps=no --with-fpx=no --with-gslib=no --with-fontpath= --with-gs-font-dir=/usr/share/fonts/type1/gsfonts
EXEC-PREFIX   /usr
HOST          i686-pc-linux-gnu
LDFLAGS       -L/usr/lib -L/usr/lib/X11 -lfreetype -lz
LIB_VERSION   0x651
LIB_VERSION_NUMBER 6,5,1,0
LIBS          -lMagickCore -llcms -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm                        -lgomp -lpthread -lltdl
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr
QuantumDepth  16
RELEASE_DATE  2009-04-09
VERSION       6.5.1
WEBSITE       http://www.imagemagick.org

Code: Select all

root@helios:~# convert logo: logo.miff
root@helios:~# convert logo: logo.jpg
root@helios:~# convert logo: logo.png
root@helios:~# convert logo: logo.jpg
root@helios:~# identify logo.*
logo.jpg JPEG 640x480 640x480+0+0 8-bit DirectClass 42.7kb
logo.miff[1] MIFF 640x480 640x480+0+0 8-bit Palette PseudoClass 256c 43.4kb
logo.png[2] PNG 640x480 640x480+0+0 8-bit PseudoClass 256c 36.2kb

i would appreciate any help or solutions

digital greetinx
toX_
Last edited by toX_ on 2009-05-04T06:14:38-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by magick »

Can you post a URL to one or two ARW images so we can download them and see if we can reproduce the problem?
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

here we go:

Photos:
http://pic.l33t.at/test.arw
http://pic.l33t.at/test2.arw

Script to get EXIF Info:
http://pic.l33t.at/exif.php


i will post more sources later

digital greetinx
toX_
Heiler81
Posts: 63
Joined: 2009-03-12T01:52:24-07:00
Authentication code: 8675309
Location: Germany, Stuttgart

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by Heiler81 »

I found that problem which looks like the same

convert: test.tif: unknown field with tag 34841 (0x8819) encountered. `TIFFReadDirectory' @ tiff.c/TIFFWarnings/526.
convert: test.tif: unknown field with tag 34842 (0x881a) encountered. `TIFFReadDirectory' @ tiff.c/TIFFWarnings/526.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by magick »

Add to your coder.xml configuration file:
  • <coder magick="ARW" name="DNG"/>
and type
  • convert arw:test.arw test.png
If you cannot edit the coder.xml file, this command should work:
  • convert crw:test.arw test.png
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

seems to work.

is there a way to use the php functions too?

like:

Code: Select all

$im = new imagick( "test.arw" );
$exifArray = $im->getImageProperties( "" );
print_r($exifArray);
ty for help and developing imagemagick :)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by magick »

If you add the ARW tag to the coders.xml configuration file, ImageMagick should be able to read your ARW files within PHP without an explicit format (e.g. image.arw should work).
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

looks like it works in the shell but within php it gives me the following error:

<b>Fatal error</b>: Uncaught exception 'ImagickException' with message '/var/www/pic.l33t.at/www/test.arw: TIFF directory is missing required "ImageLength" field. `MissingRequired'' in /var/www/pic.l33t.at/www/test.php:14
Stack trace:
#0 /var/www/pic.l33t.at/www/test.php(14): Imagick->__construct('test.arw')
#1 {main}
thrown in <b>/var/www/pic.l33t.at/www/test.php</b> on line <b>14</b><br />
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by magick »

Do you have more than one version of ImageMagick installed? Does the filename 'crw:image.arw' work? If it works from the command line it should work from PHP as well.
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

http://pic.l33t.at/info.php

Code: Select all

<?php
$width = 100;
$height = 100;
$im = new Imagick( "test.arw" );
$im->thumbnailImage( $width, $height, true );
$canvas = new Imagick();
$canvas->newImage( $width, $height, 'pink', 'png' );
$geometry = $im->getImageGeometry();
$x = ( $width - $geometry['width'] ) / 2;
$y = ( $height - $geometry['height'] ) / 2;
$canvas->compositeImage( $im, imagick::COMPOSITE_OVER, $x, $y );
header( "Content-Type: image/png" );
echo $canvas;
?>
edited the 2x coder.xml for each version with the extra line :> still the same error
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by magick »

We verified it works for us. We get a thumbnail of the ARW image with a pink border. You could try downloading ftp://ftp.imagemagick.org/pub/ImageMagi ... -1.tar.bz2. Its the version we're using with the required ARW patch. Otherwise issue this command in your PHP script:
  • identify -list format
That way it runs in your PHP environment. Is ARW listed as a format?
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

it is listed
ARW DNG r-- Sony Alpha Raw Image Format

but i'm using a php5-imagick precompiled from debian sid.
anyway the problem in general is solved

big thx :)

d.g.toX_
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

status update:
-> i don't know if this still belongs to this forum so don't flame me if i'm wrong

compiled the new imagemagick

Code: Select all

Version: ImageMagick 6.5.2-1 2009-05-05 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
compiled the new imagick (pecl) module for php

Code: Select all

imagick module	enabled

imagick module version 	2.3.0-rc1

imagick classes 	Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator

ImageMagick version 	ImageMagick 6.5.2-1 2009-05-05 Q16 OpenMP http://www.imagemagick.org

ImageMagick copyright 	Copyright (C) 1999-2009 ImageMagick Studio LLC

ImageMagick release date 	2009-05-05

ImageMagick Number of supported formats: 	198

ImageMagick Supported formats 	A, AI, ART, ARW, AVI, AVS, B, BGR, BMP, BMP2, BMP3, BRF, BRG, C, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPS, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FRACTAL, FTS, G, G3, GBR, GIF, GIF87, GRADIENT, GRAY, GRB, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RBG, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV 
but i still get errors at the php script - converting the arw file

Code: Select all

<br />
<b>Fatal error</b>:  Uncaught exception 'ImagickException' with message 'Wand contains no images `MagickWand-1' @ magick-image.c/MagickSetImageFilename/9363' in /var/www/pic.l33t.at/www/test.php:4
Stack trace:
#0 /var/www/pic.l33t.at/www/test.php(4): Imagick->__construct('test.arw')
#1 {main}  thrown in <b>/var/www/pic.l33t.at/www/test.php</b> on line <b>4</b><br />
phpscript:

Code: Select all

$width = 100;
$height = 100;
$im = new Imagick( "test.arw" );
$im->thumbnailImage( $width, $height, true );
$canvas = new Imagick();
$canvas->newImage( $width, $height, 'pink', 'png' );
$geometry = $im->getImageGeometry();
$x = ( $width - $geometry['width'] ) / 2;
$y = ( $height - $geometry['height'] ) / 2;
$canvas->compositeImage( $im, imagick::COMPOSITE_OVER, $x, $y );
header( "Content-Type: image/png" );
echo $canvas;
d.g.toX_
toX_

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by toX_ »

seems that i found out a solution:

downgraded the imagick version to 2.2.2 (stable) -> now it works

ty for all the help -> probably this is still a bug in the new 2.3.0rc1 release of imagick.

digital greetinx
toX_
johnnyg

Re: Support ARW (Sony Alpha RAW File) - ImageMagick 6.5.1-0

Post by johnnyg »

Hello all,

tox, where were you able to find the 2.2.2 version of imagick? Did you have to build it from the PECL version or did you find a php_imagick.dll of that version?

Thanks
JohnnyG
Post Reply