View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021916PatchesPackagespublic2012-05-02 09:352013-04-28 19:34
Reporterocean 
Assigned ToMattias Gaertner 
PrioritynormalSeverityminorReproducibilityalways
StatusfeedbackResolutionopen 
PlatformOSOS Version
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0021916: Timage doesn't support jpg cmyk
DescriptionColors are all wrong, example load that photo to Timage:

http://www.plaveb.com/blog/Upload/FCKeditor/image/cmyk-encoded-image.jpg [^]
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Fileszip file icon cmykjpg.zip [^] (212,644 bytes) 2012-08-03 08:53
patch file icon add_jpeg_YCCK.patch [^] (1,596 bytes) 2012-08-20 17:04 [Show Content]
zip file icon YCCK_test.zip [^] (626,544 bytes) 2013-03-05 11:22

- Relationships
related to 0022069new Lazarus Image1.Picture.LoadFromFile not work for .gif file 

-  Notes
(0061283)
ocean (reporter)
2012-07-29 19:26

Fix for fpreadjpeg.pas

Change this line:

if (FInfo.jpeg_color_space = JCS_CMYK) then

To this:

if (FInfo.jpeg_color_space = JCS_CMYK) or (FInfo.jpeg_color_space = JCS_YCCK) then

I have tested with this program. If I add fixed fpreadjpeg.pas to source dir, image saves correctly.

program jp;

{$mode objfpc}{$H+}

uses classes, sysutils, FPImage, FPreadjpeg, FPWritePNG;

procedure test;
var image: TFPCustomImage;
    writer: TFPCustomImageWriter;
begin
  image := TFPMemoryImage.Create(0,0);
  image.Loadfromfile('c:/bug/source.jpg');
  writer := TFPWriterPNG.Create;
  image.SaveToFile('c:/bug/dest.png', writer);
  image.Free;
  writer.free;
end;

begin
  test;
end.
(0061286)
Marco van de Voort (manager)
2012-07-30 01:31

ycck: http://www.jpedal.org/PDFblog/2011/10/ycck-color-conversion-in-pdf-files/ [^]
(0061303)
ocean (reporter)
2012-07-30 20:43

Thanks for link. I believe no other code changes are needed. All previously broken images I have tested work after my change. Colors are also correct.
(0061311)
Marco van de Voort (manager)
2012-07-31 11:15

According to the link it shouldn't, which is why I didn't commit the fix yet.
(0061372)
ocean (reporter)
2012-08-03 08:54

Attached CMYK image. Colors look slightly different (with or without my change, ofcourse)

Seems current code just handles YCCK better.
(0061762)
ocean (reporter)
2012-08-20 17:05

Patch attached. Added separate function for YCCK and comment about current CMYK not beeing 100% accurate.

Please review and apply if okay
(0065427)
ocean (reporter)
2013-02-03 15:27

Patch still applies. If I need to change it, please advise.

I created the patch so, that it doesn't modify existing code, it only adds this case.
(0065965)
Reinier Olislagers (developer)
2013-03-01 13:16

Any news on this?

If I understand ocean correctly, the patch only adds support for YCCK and doesn't change handling of any images marked as CMYK, so 0061311 doesn't make sense (AFAIK that link deals with images marked as CMYK but encoded with YCCK)
(0066021)
ocean (reporter)
2013-03-05 11:24

Yes, and patch should be simple change, if you look at it.

Currently YCCK is loaded as 3 channel and it looks really bad.

Attached test, just run and look file dest.jpg with/without patch.

BTW, bug should be in FPC, not Lazarus..
(0067226)
Juha Manninen (developer)
2013-04-28 19:34

Marco, why this issue is assigned to Mattias?
The patch is for FPC libraries.

- Issue History
Date Modified Username Field Change
2012-05-02 09:35 ocean New Issue
2012-05-02 09:35 ocean Widgetset => Win32/Win64
2012-05-19 01:19 Juha Manninen Relationship added related to 0022069
2012-07-29 19:26 ocean Note Added: 0061283
2012-07-29 22:38 Maxim Ganetsky Project Lazarus => FPC
2012-07-30 01:31 Marco van de Voort Note Added: 0061286
2012-07-30 20:43 ocean Note Added: 0061303
2012-07-31 11:15 Marco van de Voort Note Added: 0061311
2012-08-03 08:53 ocean File Added: cmykjpg.zip
2012-08-03 08:54 ocean Note Added: 0061372
2012-08-04 22:15 Jonas Maebe FPCOldBugId => 0
2012-08-04 22:15 Jonas Maebe Category LCL => Packages
2012-08-04 22:15 Jonas Maebe Product Version 1.1 (SVN) =>
2012-08-20 17:04 ocean File Added: add_jpeg_YCCK.patch
2012-08-20 17:05 ocean Note Added: 0061762
2012-08-31 03:21 Marco van de Voort Status new => assigned
2012-08-31 03:21 Marco van de Voort Assigned To => Mattias Gaertner
2012-08-31 03:21 Marco van de Voort Project FPC => Patches
2013-02-03 15:27 ocean Note Added: 0065427
2013-03-01 13:16 Reinier Olislagers Note Added: 0065965
2013-03-05 11:22 ocean File Added: YCCK_test.zip
2013-03-05 11:24 ocean Note Added: 0066021
2013-04-04 16:23 Reinier Olislagers Note Added: 0066803
2013-04-04 17:38 Reinier Olislagers Note Deleted: 0066803
2013-04-28 19:34 Juha Manninen LazTarget => -
2013-04-28 19:34 Juha Manninen Note Added: 0067226
2013-04-28 19:34 Juha Manninen Status assigned => feedback



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker