Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Losing color when the image is delivered via Thumbor #750

Closed
apoorvparijat opened this issue Jun 10, 2016 · 9 comments
Closed

Losing color when the image is delivered via Thumbor #750

apoorvparijat opened this issue Jun 10, 2016 · 9 comments

Comments

@apoorvparijat
Copy link

apoorvparijat commented Jun 10, 2016

Using Pillow on Ubuntu 14 and Thumbor v6.0.1, we are experiencing loss in color. Here are more details

Thumbor request URL

http://thumbor/filters:no_upscale:quality(100)/path/to/original/image

Expected behaviour

original_image

Actual behaviour

thumbor_image

As you can see from the images, the above image is less vibrant than the original (shown in Expected behaviour).

Operating system

Ubuntu 14.04.4 LTS
Pillow (3.1.1)
Thumbor v6.0.1

Your thumbor.conf

#!/usr/bin/python
# -*- coding: utf-8 -*-

from os.path import expanduser, join
home = expanduser("~")

QUALITY = 100
WEBP_QUALITY = 90

#AUTO_WEBP = False

# Preserves exif information in generated images. Increases image size in kbytes, use with caution.
PRESERVE_EXIF_INFO = False

# enable this options to specify client-side cache in seconds
MAX_AGE = 24 * 60 * 60

# client-side caching time for temporary images (using queued detectors or after detection errors)
MAX_AGE_TEMP_IMAGE = 0

# Sends If-Modified-Since & Last-Modified headers; requires support from result storage
SEND_IF_MODIFIED_LAST_MODIFIED_HEADERS = False

# the way images are to be loaded
LOADER = 'thumbor.loaders.http_loader'

MAX_SOURCE_SIZE = 62000

# how to store the loaded images so we don't have to load
# them again with the loader
STORAGE = 'thumbor.storages.file_storage'

# root path of the file storage
FILE_STORAGE_ROOT_PATH = join(home, 'thumbor', 'storage' )

# If you want to cache results, use this options to specify how to cache it
# Set Expiration seconds to ZERO if you want them not to expire.
RESULT_STORAGE = 'thumbor.result_storages.file_storage'
RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24  # one day
RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = join(home, 'thumbor', 'result_storage')

RESULT_STORAGE_STORES_UNSAFE = False

STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True

ENGINE = 'thumbor.engines.pil'

DETECTORS = [
    'thumbor.detectors.face_detector',
    'thumbor.detectors.profile_detector',
    'thumbor.detectors.glasses_detector',
    'thumbor.detectors.feature_detector',
]

FILTERS = [
    'thumbor.filters.round_corner',
    'thumbor.filters.quality',
    'thumbor.filters.watermark',
    'thumbor.filters.strip_icc',
    'thumbor.filters.grayscale',
    'thumbor.filters.rotate',
    'thumbor.filters.format',
    'thumbor.filters.no_upscale',
]

OPTIMIZERS = [
    'thumbor.optimizers.jpegtran',
    'thumbor.optimizers.gifv',
]

JPEGTRAN_PATH = '/usr/bin/jpegtran'
@guilhermef
Copy link
Member

That's probably related to Adobe RGB ICC.
Can you save the original image without it ?

@guilhermef
Copy link
Member

There's a conversion guide from Adobe RGB to RGB: http://stackoverflow.com/a/18611826/1008783
Can you test it ?

@apoorvparijat
Copy link
Author

@guilhermef These are images uploaded by clients and if stripping off Adobe RGB ICC will lead to losing color, I don't think I should strip it off.

I will test to see if the conversion works, though I have no idea how to get it implemented in Thumbor.

@apoorvparijat
Copy link
Author

This is the exiftool response for original image

ExifTool Version Number         : 10.20
File Name                       : original.jpeg
Directory                       : .
File Size                       : 1179 kB
File Modification Date/Time     : 2016:06:18 21:33:12+05:30
File Access Date/Time           : 2016:06:18 21:37:35+05:30
File Inode Change Date/Time     : 2016:06:18 21:33:18+05:30
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Current IPTC Digest             : 933403b0c97b36933494b91f74d8e4d6
Coded Character Set             : UTF8
Application Record Version      : 2
Copyright Notice                : ©2015 PHOTO FUSION MEDIA
IPTC Digest                     : 933403b0c97b36933494b91f74d8e4d6
X Resolution                    : 300
Displayed Units X               : inches
Y Resolution                    : 300
Displayed Units Y               : inches
Print Style                     : Centered
Print Position                  : 0 0
Print Scale                     : 1
Global Angle                    : 30
Global Altitude                 : 30
URL List                        :
Slices Group Name               : MN-EXTERIOR-INTERIOR
Num Slices                      : 1
Pixel Aspect Ratio              : 1
Photoshop Thumbnail             : (Binary data 8983 bytes, use -b option to extract)
Has Real Merged Data            : Yes
Writer Name                     : Adobe Photoshop
Reader Name                     : Adobe Photoshop CC 2015
Photoshop Quality               : 10
Photoshop Format                : Standard
Progressive Scans               : 3 Scans
Exif Byte Order                 : Big-endian (Motorola, MM)
Compression                     : LZW
Photometric Interpretation      : RGB
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 4
Planar Configuration            : Chunky
Resolution Unit                 : inches
Software                        : Adobe Photoshop CC 2015 (Macintosh)
Modify Date                     : 2015:10:12 12:11:28
Copyright                       : ©2015 PHOTO FUSION MEDIA
Exif Version                    : 0221
Color Space                     : Uncalibrated
Exif Image Width                : 5616
Exif Image Height               : 3744
Thumbnail Offset                : 12174
Thumbnail Length                : 8983
Profile CMM Type                : ADBE
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1999:06:03 00:00:00
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : none
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : ADBE
Profile ID                      : 0
Profile Copyright               : Copyright 1999 Adobe Systems Incorporated
Profile Description             : Adobe RGB (1998)
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Tone Reproduction Curve     : (Binary data 14 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 14 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 14 bytes, use -b option to extract)
Red Matrix Column               : 0.60974 0.31111 0.01947
Green Matrix Column             : 0.20528 0.62567 0.06087
Blue Matrix Column              : 0.14919 0.06322 0.74457
XMP Toolkit                     : Adobe XMP Core 5.6-c067 79.157747, 2015/03/30-23:40:42
Format                          : image/jpeg
Create Date                     : 2015:10:08 17:22-04:00
Metadata Date                   : 2015:10:12 12:11:28-04:00
Creator Tool                    : Adobe Photoshop CC 2015 (Macintosh)
Color Mode                      : RGB
ICC Profile Name                : Adobe RGB (1998)
Instance ID                     : xmp.iid:ae56dbdc-19bf-4c3a-91b9-5946787e5711
Document ID                     : adobe:docid:photoshop:4c4f9e64-b124-1178-9a9f-92375e20d5ad
Original Document ID            : xmp.did:47b4acce-9c83-4dad-8b99-1a436da12262
Rights                          : ©2015 PHOTO FUSION MEDIA
Document Ancestors              : adobe:docid:photoshop:222f4a58-ae44-1178-a1ee-8c5ed2de4a5f, adobe:docid:photoshop:57e9c5e2-ae3a-1178-a1ee-8c5ed2de4a5f, adobe:docid:photoshop:60e2180d-b117-1178-9a9f-92375e20d5ad, adobe:docid:photoshop:73c25b30-b114-1178-9a9f-92375e20d5ad, adobe:docid:photoshop:7aadf420-af59-1178-8881-b1ca13c32607, adobe:docid:photoshop:a21623e1-ae7f-1178-a1ee-8c5ed2de4a5f, adobe:docid:photoshop:be86d76b-ad36-1178-bad2-cbee681807f7, adobe:docid:photoshop:c91357f3-ad6c-1178-bad2-cbee681807f7, xmp.did:05fbd4f0-747b-4f51-a0bc-63ff34855532, xmp.did:101808c2-2989-42f6-b204-0737b67e94d5, xmp.did:2bd88468-5ef1-4a01-ab2d-26f07f8cf1b5, xmp.did:3a11fb1d-4529-4985-aa04-0bfd117bf755, xmp.did:4eacddb0-91b8-4df9-ae85-4c5477d10c45, xmp.did:5213093b-7463-499b-9339-a762699fb8cf, xmp.did:67a5240c-de86-48be-9bd9-bf5699088167, xmp.did:73413d0d-7be5-4d42-ac9e-93bf52e1507d, xmp.did:74141d49-2645-4669-acd4-fa3dfe000eb1, xmp.did:79b350f7-9893-4999-8158-ef8d029c9072, xmp.did:7ca78f25-c4f9-485e-a87a-a3e70c0ab626, xmp.did:7f2b11af-97ac-4dc2-83ec-c2d8870b1a40, xmp.did:83d34b76-d2eb-41fd-ba17-be91d4b237aa, xmp.did:9da34a8e-079d-4f0f-8144-b65ea4f8b82e, xmp.did:a24b1a40-3f6b-4230-a318-c898c503fe24, xmp.did:aa65ca85-957e-4893-958d-31528ad822d8, xmp.did:b06d30c1-ccaf-4690-ae49-9a1ac1bcd012, xmp.did:c6b3b0d9-c920-472e-90d0-052de6a07c61, xmp.did:d55c94e1-473d-4f21-a66d-d030cf67acc7
History Action                  : created, saved, saved, derived, saved, derived, saved, derived, saved, derived, saved, saved, derived, saved, derived, saved, saved, converted, derived, saved
History Instance ID             : xmp.iid:47b4acce-9c83-4dad-8b99-1a436da12262, xmp.iid:4b5b1088-2263-47ef-9ed7-b728948170f5, xmp.iid:fc5331e1-01f6-466a-a828-86e061938131, xmp.iid:00a5d039-450d-46f8-9b1c-184172138d60, xmp.iid:e21dd6a4-058b-43ff-a494-ae5553a76367, xmp.iid:649ae82f-2ddb-47e5-9992-2ba470af67f7, xmp.iid:68a43436-9140-41fa-a668-0d773f37c6a0, xmp.iid:2bfdd956-e238-4a4d-acbd-96f1a3f2fbd4, xmp.iid:9ed068a1-8446-4918-b443-4c29875636f8, xmp.iid:cac91593-3b68-4db7-bea8-bfb9ac0f22dc, xmp.iid:578998e3-8ebb-45b4-b639-7a6f50c9dd4f, xmp.iid:ae56dbdc-19bf-4c3a-91b9-5946787e5711
History When                    : 2015:10:08 17:22-04:00, 2015:10:08 18:27:48-04:00, 2015:10:08 19:45:50-04:00, 2015:10:08 19:59:58-04:00, 2015:10:08 20:06:44-04:00, 2015:10:08 20:09:58-04:00, 2015:10:08 20:12:45-04:00, 2015:10:08 23:40:03-04:00, 2015:10:09 10:08:47-04:00, 2015:10:09 10:15:29-04:00, 2015:10:12 12:11:28-04:00, 2015:10:12 12:11:28-04:00
History Software Agent          : Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2014 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh), Adobe Photoshop CC 2015 (Macintosh)
History Changed                 : /, /, /, /, /, /, /, /, /, /, /
History Parameters              : converted from image/tiff to application/vnd.adobe.photoshop, converted from application/vnd.adobe.photoshop to image/tiff, converted from image/tiff to application/vnd.adobe.photoshop, converted from application/vnd.adobe.photoshop to image/tiff, converted from image/tiff to application/vnd.adobe.photoshop, converted from application/vnd.adobe.photoshop to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg
Derived From Instance ID        : xmp.iid:578998e3-8ebb-45b4-b639-7a6f50c9dd4f
Derived From Document ID        : adobe:docid:photoshop:a21623e1-ae7f-1178-a1ee-8c5ed2de4a5f
Derived From Original Document ID: xmp.did:47b4acce-9c83-4dad-8b99-1a436da12262
Image Width                     : 1800
Image Height                    : 1200
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Image Size                      : 1800x1200
Megapixels                      : 2.2
Thumbnail Image                 : (Binary data 8983 bytes, use -b option to extract)

And this is the exiftool response for the thumbor image

ExifTool Version Number         : 10.20
File Name                       : actual.jpeg
Directory                       : .
File Size                       : 1634 kB
File Modification Date/Time     : 2016:06:18 21:33:24+05:30
File Access Date/Time           : 2016:06:18 21:33:31+05:30
File Inode Change Date/Time     : 2016:06:18 21:33:30+05:30
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : inches
X Resolution                    : 72
Y Resolution                    : 72
Image Width                     : 1800
Image Height                    : 1200
Encoding Process                : Progressive DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Image Size                      : 1800x1200
Megapixels                      : 2.2

Any suggestions on how to go about this?

@cerber717
Copy link
Contributor

cerber717 commented Aug 11, 2016

👍
I new information on this one ?
We have the same issue. in our case red color becomes brighter then the original. other colors are affected too, but the red is most noticeable

@rogersd
Copy link

rogersd commented Oct 25, 2016

Can we get an update here? This is an issue for us too.

@heynemann
Copy link
Member

Sorry for the long time it took me to reply. Is this still something you are dealing with?

@wiledal
Copy link

wiledal commented Oct 12, 2020

I'm having an issue that I think is related, however slightly more obscure.

Colors are washed out, but only when viewed in WebGL on Safari.

Chrome, (left WebGL, right img-tag)
Screen Shot 2020-10-12 at 6 29 40 PM
Screen Shot 2020-10-12 at 6 30 29 PM

Safari, (left WebGL, right img-tag)
Screen Shot 2020-10-12 at 6 30 12 PM
Screen Shot 2020-10-12 at 6 30 39 PM

Color is only affected if the image is scaled. Applying filters or even changing the format leaves the colors vibrant.
When downloaded and re-exported from Photoshop, the colors look fine.

@heynemann
Copy link
Member

Closing this issue since we had no activity for a while in the interest of keeping our Issues list leaner. If this is something we still need to pursue, please reopen and I'll look into it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants