500 errors with GD2 image generation

Discussion in 'Ruby' started by Cheshire Cat, Jun 1, 2006.

  1. Cheshire Cat

    Cheshire Cat Guest

    I've created an application with Rails that uses Ruby/GD2
    (http://gd2.rubyforge.org/) to create raster images. I've had trouble
    with image corruption from the beginning, and this is an issue I never
    had with GD in PHP. I don't know if it's due to a) a bad set of Ruby
    bindings and I should use something other than Ruby/GD2, b) something
    Rails-specific that's different from PHP and causes image corruption,
    or c) something else. It seems that JPEG's are by far the most
    forgiving format, because even when they're corrupt, the image still
    loads in the browser, whereas with corrupt PNG's and GIF's, I just get
    either a) a 500 error or b) a note about the image having errors.
    Maybe this is more with how Firefox handles its images.

    However, I shouldn't even have to worry about how Firefox or other
    browsers handle corrupt images because I shouldn't be getting corrupt
    images in the first place. I'm doing very straight-forward stuff
    involving generating a table of text and shapes, black and other

    Some of the things that have seemed to reduce corruption:
    - making sure nothing overlaps: text gets truncated to fit in a
    certain column width, because when it overlaps into the other column of
    text, I get corruption; the same goes for if shapes overlap other
    things in the image
    - reducing the image quality: I don't know what Ruby/GD2's default
    JPEG quality is, but setting it to 70 seems to remove corruption

    By corruption, I mean artifacts. Example: the image will be fine up
    until a certain row, and then the background will suddenly switch to
    some seemingly arbitrary color, there will be a little blotch of gray,
    and the rest of the image has that strange color kind of overlaying the
    rest of the data.

    I'm using Rails 1.1.2, Ruby 1.8.4, FastCGI with Apache, and GD

    Does anyone have any ideas about why I might be getting corrupt images
    or how to fix them?
    Cheshire Cat, Jun 1, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Leslie
    Lionel Thiry
    Nov 5, 2005
  2. Rob Leslie

    [ANN] Ruby/GD2 1.0

    Rob Leslie, Nov 15, 2005, in forum: Ruby
    Tom Copeland
    Nov 15, 2005
  3. Chris Webb


    Chris Webb, Feb 1, 2006, in forum: Ruby
    Chris Webb
    Feb 1, 2006
  4. Jonathan Métillon
    Jonathan Métillon
    Jun 19, 2008
  5. yahata hisashi

    Does Ruby/GD2 work on ruby-mswin32?

    yahata hisashi, Sep 15, 2008, in forum: Ruby
    yahata hisashi
    Sep 15, 2008

Share This Page