Branch: Tag:

2013-02-07

2013-02-07 11:06:05 by Leif Stensson <leif.stensson@roxen.com>

Since the default processing of JPEG in Image.JPEG was changed to
take EXIF Orientation into account, let's update Image.Dims to also
take that into account, so it correctly predicts the dimensions that
will result from loading the image.

125:    case M_SOF15: /* Differential lossless, arithmetic */    int image_height, image_width;    sscanf(f->read(7), "%*3s%2c%2c", image_height, image_width); +  if (f->seek(0) == 0) +  { +  mapping exif = Standards.EXIF.get_properties(f); +  if ((< "5", "6", "7", "8" >)[exif->Orientation]) +  { +  // Picture has been rotated/flipped 90 or 270 degrees, so +  // exchange width and height to reflect that. +  int tmp = image_height; +  image_height = image_width; +  image_width = tmp; +  } +  }    return ({ image_width,image_height });    break;