Skip to content

Commit

Permalink
Handle broken, embedded ICC profile #131
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Dec 3, 2014
1 parent f4cc6a2 commit e1b5574
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/resize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ class ResizeWorker : public NanAsyncWorker {
// Convert to sRGB using embedded profile
std::string srgbProfile = baton->iccProfilePath + "sRGB_IEC61966-2-1_black_scaled.icc";
VipsImage *transformed;
if (vips_icc_transform(image, &transformed, srgbProfile.c_str(), "embedded", TRUE, NULL)) {
return Error(baton, hook);
if (!vips_icc_transform(image, &transformed, srgbProfile.c_str(), "embedded", TRUE, NULL)) {
// Embedded profile can fail, so only update references on success
vips_object_local(hook, transformed);
image = transformed;
}
vips_object_local(hook, transformed);
image = transformed;
} else if (image->Type == VIPS_INTERPRETATION_CMYK) {
// Convert to sRGB using default "USWebCoatedSWOP" CMYK profile
std::string srgbProfile = baton->iccProfilePath + "sRGB_IEC61966-2-1_black_scaled.icc";
Expand Down

0 comments on commit e1b5574

Please sign in to comment.