Reputation: 7672
I want to rotate .eps
file using imagemagick or GhostScript command line. I have successfully rotated .tif/.tiff
file but unable to rotate .eps
file.
What I have tried?
Using ImagicMagick
I have tried following commands.
/usr/bin/convert /usr/local/1476864737b31068.eps -rotate 90 /usr/local/1476864737b31068.eps
Result : -
Whole eps file become black and there is no content in file. File size also increased to 3.3MB from 1.3MB
Using GhostScript
I have tried following commands.
gs -c '612 0 translate 90 rotate' -f /usr/local/1476864737b31068.eps
gs -dEPSCrop -c "<</Orientation 1>> setpagedevice" -f input.eps -c quit
gs -dEPSCrop -sOutputFile=/usr/local/1476864737b31068.eps -c "<</Orientation 1>> setpagedevice" -f /usr/local/1476864737b31068.eps -c quit
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=eps2write -sOutputFile=/usr/local/1476864737b31068.eps -c "<</Orientation 3>> setpagedevice" -f /usr/local/1476864737b31068.eps
Result : -
No command do rotation and with last command, whole eps file become white but there is noting in file. File size also reduced to 166KB from 1.3MB
Note: I am trying to rotate source (.eps) file, I don't need rotation on output file like JPG, PNG etc file.
Upvotes: 2
Views: 1787
Reputation: 31199
So you didn't say which way you wanted the file rotated, nor by how much.
This command line:
gs -sDEVICE=eps2write -sOutputFile=out.eps -c "<</PageSize [569 944]>>setpagedevice 569 0 translate 90 rotate" -f 1476864737b31068.eps
Creates a new EPS file which is rotated 90 degrees anti-clockwise with respect to the original. Obviously you'll need to alter the translate and rotate operands if you want to rotate by different amounts.
Of course, EPS files are meant to be included in an enclosing PostScript program so the scaling and rotation are normally performed there.
Final note; this isn't simply 'rotating the EPS', the code between -c and -f does that. What this does is interpret the EPS to graphics primitives, pass those primitives to the device, and then assemble a new output file containing an appropriate representation of those primitives.
So the resulting EPS file's contents look nothing like the contents of the original EPS file.
By the way, you might want to consider a different file sharing service. That one tried to download a browser extension (video download helper) before letting me download the file, and when I refused redirected me to another (advertising) site which tried to install malware....
Upvotes: 3