ruby-imagespec icon indicating copy to clipboard operation
ruby-imagespec copied to clipboard

Bug fix for Exif JPEGS

Open wassinki opened this issue 15 years ago • 0 comments

When a JPEG contains a Exif header, the parser gets into troubles. This bug fix may solve the problem:

in JPEG.rb

  def self.detected?(stream)
    stream.rewind
    case stream.read(10)
      when /^\xff\xd8\xff\xe0\x00\x10JFIF/ then true
      when /^\xff\xd8\xff\xe1/ && /Exif$/  then true # bug fix, cannot do match *
      # when /^\xff\xd8\xff\xe1(.*){1}Exif/  then true
      else false
    end
  end

wassinki avatar May 31 '10 07:05 wassinki