Making Graphic Magick detect Ghostscript for reading pdf on Windows. How to change Ghostscript invocation name on WINDOWS CMD to 'gs'? - windows

My OS is Windows 10. What I did for Ghostscript installation:
I installed Ghostscript (v9.53.3)
I added Ghostscript bin folder location to my environment PATH variable. (C:\Program Files\gs\gs9533\bin)
I restarted my machine.
After this step, my cmd is able to recognize "gswin64c" command. However, "gs" is not recognized. According to Ghostscript examples, the 'gs' command should work. What must I do to make "gs" command recognized? Should I be worried here?
Now, to my Graphics Magick Problem:
I am also using Graphic Magick v1.3.36 (GM) on my machine. My GM does not have the delegate for pdf format even after I installed Ghostscript as mentioned above. As seen in this error which shows every time I try to convert a pdf file to images using gm.
C:\program files\graphicsmagick-1.3.36-q16\gm.exe convert: No decode delegate for this image format (file1.pdf)
My suspicion is that the 'gs' command is not recognized in windows and this is causing GM to be unable to detect Ghostscript.
I would value any suggestion of how to make GM work with ghostscript on my windows machine. Thank you.
UPDATE (5th March 2021)
I found out that changing the command to gs for Ghostscript does not fix GM's pdf delegate problem -- GM still cannot detect Ghostscript!! My suspicion above is wrong.

I was struggling with "GM's pdf delegate problem" too. And I found out that GraphicsMagick uses the Ghostscript Fonts (also known as "URW Fonts") to support the standard set of Adobe Postscript fonts like "Helvetica" and "Times Roman".
Download fonts from here Ghostscript Fonts and paste downloaded folder fonts to the folder with Ghostscript files **C:Program Files\gs\gs9.27**. Here you could find more information.

After installing ghostscript and adding it's path to environment variables and checking it by running gswin64c command.
Update the delegates.mgk file present at C:\Program Files\GraphicsMagick-1.3.34-Q16
The delegates.mgk entry looks somewhat like this by default-
<delegate decode="pdf" encode="eps" mode="bi" command='"#PSDelegate#" -q -dBATCH -dSAFER -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=#GSEPSDevice# "-sOutputFile=%o" -- "%i" -c quit' />
Note the #PSDelegate# env variable in the command, Just find and replace all the #PSDelegate# with the path gswin64c at all places. After this Graphic Magick will start delegating the tasks to Ghostscript.
Also there's a issue with Graphic Magick v1.3.36 for windows, as mentioned by one of the maintainers here
So try installing an older version.
A similar issue has been explained on this question as well.

Related

Is there a way to convert a ps file with ghostscript on Windows without access to the command prompt (cmd)?

I hope that I find the right words to explain my problem. I want to convert an adobe illustrator file to png on a Windows machine where I have no admin rights, no Adobe Illustrator and no access to the cmd.
On my Ubuntu machine I can easily use something like
gs -dNOPAUSE -dBATCH -dEPSFitPage -sDEVICE=png16m -r600 -sOutputFile=test.png ai.ai
But on the Windows Machine I could only install Ghostscript 9.5, which starts into a GUI with a prompt that says "GS>". I never used that, so I just thought that I could write something like
-dNOPAUSE -dBATCH -dEPSFitPage -sDEVICE=png16m -r600 -sOutputFile=test.png ai.ai
But then I get only error messages and after some reading I found out that this interpreter is something different where people can put thinks on a stack or so. Can I somehow use this GS interpreter to do what my gs on the Linux machine did from the shell?
Best regards
Martin
PS: Windows 10 machine, whatelse do you need?

Kivy Atlas Creation On Windows

Seems like Kivy APIs are steered towards Linux systems more than anything. Has anyone success created a kivy atlas on windows using the command prompt?
If so, how is it done?
Full working code please.
Actually this manual works on Windows. You need to use console (press Win+R, type cmd and press Enter).
cd to your project folder and use the following command (with your image filenames and sizes, obviously). And it's dir on Windows, not ls, but otherwise it's the same.
python -m kivy.atlas myatlas 256x256 img1.png img2.png
This simplest way under Windows for me was the following...
Create a script with a string template of the Json code which constructs the atlas.
ImgSize = 512x512
AtlasT = """
{
"run.png": {
%s
}
}
"""
You would then create a loop, that will loop through all directories you specify, gathering all the images and formatting the template.
Save the atlas at the end. All mathematics are calculated by the script based on the size of the images.
If you use the linux terminal command as per the docs, you'll get an error. Just enter this into windows commmand line window - python - m, and hit enter. You'll get an error saying python is not recognized as an external or internal command or something like that.
Linux Ubuntu is far different from Windows. It seems like Linux is always aware of what you install so if you address something by name like, python, you'll get feed back. That's not the same under Windows. In order to use python on windows you really have to point to python.exe.
Don't bother using the kivy docs atlas command line in windows. Windows won't understand kivy.atlas either. It's not Linux!

Create Hybrid Mac and Windows ISO with custom main folder settings

I'm trying to create an hybrid CD able to autorun on Windows machines and auto-open the main folder with a custom background on Mac OSX.
The CD has to start an application in flash showing also some PDF files.
Here the scheme of the CD files and folders:
application.exe <-- the app for windows
autorun.inf <-- the autorun file for windows
application.app <-- the app for mac osx
/documents <-- the folder which contains the PDF files for both the applications
/background <-- the folder which contains the background image for Mac OSX
Following this answer I was able to set a background folder image for mac and create the first hybrid ISO with this command:
hdiutil makehybrid -o [image.iso] [my_project_folder] -iso -hfs -hide-iso [file to hide on windows] -hide-hfs [file to hide on mac]
Unfortunately with this command I wasn't able to hide more than one file; I need at least 2 (.exe and .inf) for mac.
And even if the background results correctly set to my original folder when I open the ISO it seems to lost it and other settings like the window and icons dimensions.
Update:
The correct syntax for hdiutil command to hide multiple files is the following:
hdiutil makehybrid -o image.iso source_folder -iso -hfs -hide-iso cd_folder/application.app -hide-hfs "{cd_folder/application.exe,cd_folder/autorun.inf}"
Unfortunately the folder background image, window dimensions and icon positioning still desappear in the iso file.
It is possible to re-set them again but every time the iso is ejected and re-mounted OSX seems to forget my preferences...
Solution:
After several attempts I have finally found the cause: the read and write mount command hdiutil attach -readwrite myCD.iso does't work on Mountain Lion
Therefore the OS doesn't save / remember my preferences.
I have noticed this behaviour also trying to create the hybrid image with Toast; when I have tried to mount myCD.toast and change the icon position it wasn't allowed (and I realized the problem).
Hence I replicate the process with my old Snow Leopard and everything worked perfectly! Also creating the hybrid CD with Toast is really easier and fully customizable.
What I do is make a read-write disk image, set up background image, icon size, and so on, unmount the image, and make sure it restores properly on remount. To get a designated folder to open when the image mounts, I use the bless command. Once the read-write image works as I want, I make the hybrid image using the read-write image as the source. I've made a set of AppleScript programs to simplify the process.

Dia command line not working on OSX

I've got a problem with using Dia from the command line on OSX 10.7.4. I downloaded and installed the OSX dmg from http://dia-installer.de/download/macosx.html I've been using it to create graphics for a paper and absolutely love it.
I'm using a makefile to call pdflatex, bibtex, and R so that that it will build everything from scratch if need be, but can't get Dia's command line to work.
I want to use the command line with -e and -t to export the graphics to a specific directory so that pdflatex can put them in the pdf. (http://dia-installer.de/doc/en/re01.html)
The problem that I'm running into is that anytime I call it from the terminal, it brings up the GUI. Even if I give move to /Applications/Dia.app/Content/Resources/bin/ and use the command "./dia -v". It gives me a bunch of errors about "Input method" and then shows the GUI.
I looked on the Dia FAQ and it has a lot of information for the Windows command line, but nothing for OSX.
I'm hoping that someone here has run into this before and knows how to get it to work.
Thanks in advance.

How to override Windows' convert command by ImageMagick's one?

In Windows, a command called convert is used to convert the filesystems. When you type convert, it will ask you to specify a filesystem.
In ImageMagick, convert command is used for image processing.
The problem is, even after setting the environment variable for ImageMagick convert, the tool doesn't get invoked. It calls only the Windows convert command. How to override that?
This is an old question, but the current solution with ImageMagick 7 is to use the "magick" command in place of "convert".
This is an old question, but I encountered this problem today, and this is my solution in Windows 7.
Windows convert.exe is located in folder C:\Windows\System32, so you have to modify the Windows PATH variable by putting the ImageMagick path (for example C:\Libs\ImageMagick-6.8.8-4) before the path that loads System32 (ie. %SystemRoot%\System32).
This will cause all ImageMagick executables to take priority over any similarly named system executables, which should do what you want but may cause unexpected behaviour.
Also, when you want to use the system convert.exe, you'll have to specify the full pathname such as C:\Windows\System32\convert.exe.
Renaming the ImageMagick convert.exe worked well for me.
I didn't like using full path each time, and changing the system PATH variable isn't possible for me on the work PC.
After renaming convert.exe to imgconvert.exe, no other changes were needed. You could now use the new command anywhere from the command line without it being confused with the intrinsic Windows file system convert
Edit: As of version 7.0, the command is now magick.exe, which no longer clashes with any native windows commands. So downloading the latest version if possible should solve the problem as well.
Did you logoff and login?
Or specify the Imagemagick's convert by providing the complete path
In powershell you can run this: $env:Path = "C:\path-to-convert\;$env:Path"
Now the imagemagick convert exe gets found because it comes first in the path.

Resources