‘^’ is ignored by Python – how to escape ‘^’ character in Popen Windows?

Why Python cuts ‘^’ character and how to avoid it? Python does not cut ^ character. Popen() passes the string (resize_command) to CreateProcess() Windows API call as is. It is easy to test: #!/usr/bin/env python import sys import subprocess subprocess.check_call([sys.executable, ‘-c’, ‘import sys; print(sys.argv)’] + [‘^’, ‘<– see, it is still here’]) The latter command … Read more

ImageMagick – “CORE_RL_magick_.dll not found” or how to install RMagick on windows with ruby 1.9.2

I’ve finally managed to install ImageMagick and build the RMagick gem and make it all work. Hooray. It seems like the problem was in the DLL itself. When I tried to registed it, windows gave me a nice error about a problem with the dll. So my way of solving all the issues is: Go … Read more

Python Wand convert PDF to PNG disable transparent (alpha_channel)

I also had some PDFs to convert to PNG. This worked for me and seems simpler than compositing images, as shown above.: from wand.image import Image from wand.color import Color all_pages = Image(blob=self.pdf) # PDF will have several pages. single_image = all_pages.sequence[0] # Just work on first page with Image(single_image) as i: i.format=”png” i.background_color = … Read more

Converting PDF to CMYK (with identify recognizing CMYK)

sdaau, the command you used for trying to convert your PDF to CMYK was not correct. Try this one instead: gs \ -o test-cmyk.pdf \ -sDEVICE=pdfwrite \ -sProcessColorModel=DeviceCMYK \ -sColorConversionStrategy=CMYK \ -sColorConversionStrategyForImages=CMYK \ test.pdf Update If color conversion does not work as desired and if you see a message like “Unable to convert color space … Read more

ImageMagick no decode delegate

I had this error when rendering an image using DragonFly in Rails. This happened after I upgraded to Lion (ImageMagick was installed using Brew). I reinstalled ImageMagick, jpeg, libtiff and jasper (reinstalling ImageMagick wasn’t enough by itself). brew uninstall imagemagick jpeg libtiff jasper brew install imagemagick Prior to that, running identify -list format and jpeg … Read more

ImageMagick: scale JPEG image with a maximum file-size

To restrict the resulting image to a maximum file size, you can use the commandline parameter -define jpeg:extent=max_value, like this: convert original.jpeg -define jpeg:extent=300kb output.jpg convert original.jpeg -define jpeg:extent=300kb -scale 50% output.jpg convert original.jpeg -define jpeg:extent=300kb […other options…] output.jpg Note, this will not always work to match the exact size you wanted. You may have … Read more

rmagick gem install “Can’t find Magick-config”

When building native Ruby gems, sometimes you’ll get an error containing “ruby extconf.rb”. This is often caused by missing development libraries for the gem you’re installing, or even Ruby itself. Do you have apt installed on your machine? If not, I’d recommend installing it, because it’s a quick and easy way to get a lot … Read more