Converting JPEG from RGB to CMYK results in segfault #36

bf4 opened this Issue Jul 24, 2014 · 0 comments


None yet
1 participant

bf4 commented Jul 24, 2014

Issue by meanphil
Tuesday Jul 10, 2012 at 23:27 GMT
Originally opened as #55

Trying to save any image as a CMYK Jpeg will result in a crash. If you change CMYK to any other colorspace such as RGB, CMY, or Gray it writes the image OK.

My test script is as follows:

require 'rubygems'; require 'RMagick'

i ='test.jpg').first 
i.write("cmyk.jpg") do |ii|
    ii.format = 'JPEG'
    ii.colorspace = Magick::CMYKColorspace
$ ruby test.rb 
test.rb:4: [BUG] Segmentation fault

gdb says the segfault is in ImageMagick here:

0x0000000803642ef7 in WriteJPEGImage (image_info=0x80386f000, image=0x803859000) at coders/jpeg.c:2604
2604                  *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange-

However the following command line works fine, so it must be something that RMagick is (not?) doing:

convert test.jpg -colorspace CMYK cmyk.jpg

Environment is Ruby 1.9.3-p194, ImageMagick 6.7.7-7, RMagick 2.13.1, FreeBSD 8.2, gcc 4.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment