Page 1 of 1

Extracing SVG data... from JPG

Posted: 2012-10-19T05:33:44-07:00
by pkvisualid
Hi IM folks,

My first post, not sure if I'm dealing with a bug or a feature - but to me it's a problem in any case.

I have been using ImageMagick for a number of years to extract SVG data from JPG files - the images concerned are JPEGs that have embedded paths created in Photoshop. Normally one would use TIFF or EPS to be able to utilise these paths, but my web app is able to extract the paths from the JPEG format, thereby allowing much smaller file sizes than EPS or TIFF. Unfortunately this feature stopped working on a recent install.

The command I use to retrieve the SVG data is

Code: Select all

identify -verbose /path/to/image.jpg
I then use regex to parse the output to create a TIFF mask from the SVG data.

This is working perfectly on CentOS 5.5, ImageMagick 6.6.7-2
It is NOT working on CentOS 5.8, ImageMagick 6.6.5-10

On the latter version, it IS possible to retrieve the SVG data if the file is a TIFF, but not when it's a JPEG.
A sample image is available here: http://198.101.244.68/testsvg.jpg
The configuration details for the two installs are below.

Any help greatly appreciated!

Pier

##### IM 6.6.5, CentOS 5.8 ######
Path: /usr/lib64/ImageMagick-6.6.5/config/configure.xml

Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -fopenmp -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
CONFIGURE ./configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-shared' '--disable-static' '--with-modules' '--with-perl' '--with-x' '--with-threads' '--with-magick_plus_plus' '--with-gslib' '--with-wmf' '--with-lcms' '--with-rsvg' '--with-xml' '--with-perl-options=INSTALLDIRS=vendor CC='\''gcc -L/usr/src/redhat/BUILD/ImageMagick-6.6.5-10/magick/.libs'\'' LDDLFLAGS='\''-shared -L/usr/src/redhat/BUILD/ImageMagick-6.6.5-10/magick/.libs'\''' '--without-dps' '--without-included-ltdl' '--with-ltdl-include=/usr/include' '--with-ltdl-lib=/usr/lib64' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
COPYRIGHT Copyright (C) 1999-2010 ImageMagick Studio LLC
CPPFLAGS -I/usr/include/ImageMagick
CXX g++
CXXFLAGS -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib djvu fontconfig freetype gs jpeg jng jp2 lcms png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fontpath=
EXEC-PREFIX /usr
FEATURES OpenMP
HOST x86_64-redhat-linux-gnu
LDFLAGS -L/usr/lib64
LIB_VERSION 0x665
LIB_VERSION_NUMBER 6,6,5,10
LIBS -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr
QuantumDepth 16
RELEASE_DATE 2011-06-02
VERSION 6.6.5
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
NAME ImageMagick
##############################

##### IM 6.6.7, CentOS 5.5 ######
Path: /usr/local/lib/ImageMagick-6.6.7/config/configure.xml

Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -fopenmp -g -O2 -Wall -pthread
CONFIGURE ./configure '--with-png' '--with-tiff' '--with-jpg'
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX g++
CXXFLAGS -g -O2 -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES jpeg jng mpeg png tiff zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-fontconfig=no --with-gslib=no --with-fontpath= --with-rsvg=no --with-xml=no --with-perl=no
EXEC-PREFIX /usr/local
FEATURES OpenMP
HOST i686-pc-linux-gnu
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x667
LIB_VERSION_NUMBER 6,6,7,2
LIBS -lMagickCore -ltiff -ljpeg -lpng -lz -lm -lgomp -lpthread
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2011-01-24
VERSION 6.6.7
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
NAME ImageMagick
##############################

Re: Extracing SVG data... from JPG

Posted: 2012-10-19T10:10:57-07:00
by fmw42
You have regressed to an older version of IM. On my Mac OSX Snow Leopard IM 6.8.0.1 Q16, I get

identify -verbose test.svg.jpg
....

Clipping path:
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="1782" height="1782">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 861,0
C 1296.4,-456199 1591.22,252.185 1716,556
C 1801.17,763.371 1801.39,1028 1714,1234
C 1606.74,1486.83 1411.66,1662.22 1137,1748
C 1091.01,1762.36 1041.57,1767.76 990,1777
C 967.002,1778.67 943.998,1780.33 921,1782
C 886.501,1787.75 830.69,1782.22 801,1777
C 775.669,1773.67 750.331,1770.33 725,1767
C 656.632,1751.84 594.356,1732.73 537,1708
C 291.432,1602.1 120.607,1411.18 37.0001,1143
C 5.78481,1042.87 -456208,887.261 9.00006,761
C 20.9968,701.115 30.8421,643.861 51,592
C 153.292,328.832 328.957,153.432 592,51
C 645.864,30.0248 705.366,20.2275 768,8.00004
C 798.997,5.33361 830.003,2.66643 861,0 Z
"/>
</g>
</svg>

Profiles:
Profile-8bim: 6080 bytes




Is that what you were trying to extract? The clipping path should also be in the 8bim profile. See

http://www.imagemagick.org/Usage/masking/#clip-path

Re: Extracing SVG data... from JPG

Posted: 2012-10-23T03:08:34-07:00
by pkvisualid
Thanks for your response - that is indeed the information I am trying to extract.
Hopefully it is indeed a simple version issue, I'll try and resintall IM version 6.8 and see what happens.

Best

Pier