LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-14-2012, 09:20 AM   #1
Daravon
Member
 
Registered: Mar 2006
Posts: 166

Rep: Reputation: 15
ImageMagick convert and eps


I'm trying to compile a \LaTeX document. As you know, \LaTeX wants images in .eps format. I naively attempted to use convert to convert my jpgs to eps format, but I'm having a weirdness. The image dimensions change randomly, and the file size gets inflated like 10x in some cases.

Code:
chaz@optimus:~/docs/teX/robot/jpgs$ ls
badrake.jpg  bentwasher.jpg  betterrake2.jpg  screen.jpg  screws.jpg  stations.jpg  teachpoint2.jpg
chaz@optimus:~/docs/teX/robot/jpgs$ for blah in `ls *.jpg`; do blarg=`echo $blah | sed 's/\..\{3\}$//'`; convert $blah $blarg.eps; done 
chaz@optimus:~/docs/teX/robot/jpgs$ ls
badrake.eps  bentwasher.eps  betterrake2.eps  screen.eps  screws.eps  stations.eps  teachpoint2.eps
badrake.jpg  bentwasher.jpg  betterrake2.jpg  screen.jpg  screws.jpg  stations.jpg  teachpoint2.jpg
chaz@optimus:~/docs/teX/robot/jpgs$ identify ./*
./badrake.eps PS 1023x714 1023x714+0+0 16-bit DirectClass 800KB 0.000u 0:00.000
./badrake.jpg[1] JPEG 1023x714 1023x714+0+0 8-bit DirectClass 127KB 0.000u 0:00.000
./bentwasher.eps[2] PS 150x113 150x113+0+0 16-bit DirectClass 35.7KB 0.000u 0:00.000
./bentwasher.jpg[3] JPEG 1000x750 1000x750+0+0 8-bit DirectClass 501KB 0.000u 0:00.000
./betterrake2.eps[4] PS 180x127 180x127+0+0 16-bit DirectClass 40.5KB 0.000u 0:00.000
./betterrake2.jpg[5] JPEG 1201x846 1201x846+0+0 8-bit DirectClass 213KB 0.000u 0:00.000
./screen.eps[6] PS 879x560 879x560+0+0 16-bit DirectClass 873KB 0.000u 0:00.000
./screen.jpg[7] JPEG 879x560 879x560+0+0 8-bit DirectClass 141KB 0.000u 0:00.000
./screws.eps[8] PS 750x544 750x544+0+0 16-bit DirectClass 416KB 0.000u 0:00.000
./screws.jpg[9] JPEG 750x544 750x544+0+0 8-bit DirectClass 69.1KB 0.000u 0:00.000
./stations.eps[10] PS 120x90 120x90+0+0 16-bit DirectClass 27.8KB 0.000u 0:00.000
./stations.jpg[11] JPEG 800x600 800x600+0+0 8-bit DirectClass 202KB 0.000u 0:00.000
./teachpoint2.eps[12] PS 150x113 150x113+0+0 16-bit DirectClass 32.5KB 0.000u 0:00.000
./teachpoint2.jpg[13] JPEG 1000x750 1000x750+0+0 8-bit DirectClass 147KB 0.000u 0:00.000
or that file format
chaz@optimus:~/docs/teX/robot/jpgs$ du -h ./*
4.3M	./badrake.eps
136K	./badrake.jpg
4.4M	./bentwasher.eps
500K	./bentwasher.jpg
6.0M	./betterrake2.eps
216K	./betterrake2.jpg
2.9M	./screen.eps
148K	./screen.jpg
2.4M	./screws.eps
76K	./screws.jpg
2.8M	./stations.eps
208K	./stations.jpg
4.4M	./teachpoint2.eps
152K	./teachpoint2.jpg
chaz@optimus:~/docs/teX/robot/jpgs$
For example, one image went from JPEG 1201x846 to PS 180x127, yet the file size went from 216K to 6M! Other images didn't change in geometry at all. What's going on here?

Last edited by Daravon; 02-14-2012 at 09:22 AM.
 
Old 02-14-2012, 11:50 AM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,950
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
It's been a while since I've worked with it but my notes show ImageMagick comes with a command called "mogrify" that lets you specify sizes:

For example:
mogrify -resize "60x88" image.png

One thing I noticed at the time was that it made the resulting image 60x25 because it kept the original ratios on image size which is what I really wanted. I haven't worked on eps files but did want to mention this as at the time I kept looking for a "resize" command and it took me a bit of work to figure out mogrify was what I really needed.
 
Old 02-14-2012, 04:57 PM   #3
Daravon
Member
 
Registered: Mar 2006
Posts: 166

Original Poster
Rep: Reputation: 15
The thing is I'm NOT trying to resize anything. I just used convert, which should have just converted the format. The odd thing is that some images were resized and some weren't. I understand that a .eps file could be bigger than a .jpg due to the format, compression, etc but I didn't expect 200k to 6M disk usage inflation.

Is there some other tool for making this conversion, or am I using this wrong?
 
Old 02-14-2012, 07:54 PM   #4
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,103

Rep: Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102
Hi,

this is not really an answer to the question you posted, but a possible different approach.

Have you considered using pdflatex? pdflatex will let you use \includegraphics{} png, jpg, pdf and many more.
Instead of producing a dvi output file it produces a pdf. If you also have ps/eps input images that you \includegraphics{} you can convert them to pdf (ps/eps -> pdf conversion using epstopdf is quite clean).

I switched from using latex/dvips/dvipdf to pdflatex about 5 years ago and have never looked back.

HTH,

Evo2.
 
1 members found this post helpful.
Old 02-15-2012, 07:56 AM   #5
Daravon
Member
 
Registered: Mar 2006
Posts: 166

Original Poster
Rep: Reputation: 15
I have considered it. I assumed I would need to do some things to "port" my source to use pdflatex. If not, I guess there's really no disadvantage. I will try to compile my existing documents with pdflatex and see what happens.
 
Old 02-15-2012, 11:13 AM   #6
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,950
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
Quote:
Originally Posted by Daravon View Post
The thing is I'm NOT trying to resize anything.
I understood that - I was suggesting you might be able to resize the result of convert back to the size you want.
 
Old 02-15-2012, 07:23 PM   #7
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,103

Rep: Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102
Hi,

Quote:
Originally Posted by Daravon View Post
I have considered it. I assumed I would need to do some things to "port" my source to use pdflatex. If not, I guess there's really no disadvantage.
Your .tex files should be fine unless you use things like pstricks.

Quote:
I will try to compile my existing documents with pdflatex and see what happens.
Please post back to let us know how it goes.

Cheers,

Evo2.
 
Old 02-16-2012, 04:06 PM   #8
Daravon
Member
 
Registered: Mar 2006
Posts: 166

Original Poster
Rep: Reputation: 15
So you would compress the file by sizing it down and then back up?

That might work but I use mogrify -compression jpeg -quality 50 to compress file size without scaling down.

By the way, I compressed my starting jpegs down about 50% in file size and re-converted to EPS. There was no difference in the size of the resulting EPS files. EPS files are just big!

Also, identify does not report EPS files size sensibly. EPS might not even have the property of size, for all I know.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using convert from imagemagick package to convert multiple jpg files janis_169 Linux - Newbie 5 07-18-2010 04:22 PM
ImageMagick - convert cornish Linux - Software 3 06-13-2006 08:26 AM
Imagemagick convert yields blank image jlinkels Linux - Software 4 05-05-2006 08:41 AM
ImageMagick - how to convert green pixels to red? BrianK Linux - General 1 03-24-2006 09:26 PM
where would I find ImageMagick's convert program? kuplo Linux - Software 1 01-12-2006 12:00 AM


All times are GMT -5. The time now is 12:33 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration