View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021916FPCPackagespublic2012-05-02 09:352014-03-04 16:24
Reporterocean 
Assigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionProduct Build 
Target Version2.8.0Fixed in Version2.6.4 
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.
FPCOldBugId0
Fixed in Revision26325
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 0022069resolvedBart Broersma 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 (reporter)
2013-04-28 19:34

Marco, why this issue is assigned to Mattias?
The patch is for FPC libraries.
(0070152)
ocean (reporter)
2013-09-18 11:33

Patch is still waiting feedback. Can't release project sources, when depends on patches
(0071725)
Reinier Olislagers (developer)
2013-12-02 10:42

As Juha@0067226 mentions:
Please assign to FPC - the problem & patch is with fcl-image, nothing related to Lazarus.
(0071745)
Reinier Olislagers (developer)
2013-12-03 13:22

Problem & fix confirmed.
Given the fact that the patch does not modify existing functionality but adds support for another encoding, suggest an FPC dev implement the patch.
Thanks.

FPC x86 + FPC x64 r26170, Windows.
Ran test program with associated jpg in YCCK_test.zip
The original jpg displays ok in Windows image viewer.
As expected, the test program generates a corrupted jpg file dest.jpg

Ran patch add_jpeg_YCCK.patch from zip file.
Patch applies cleanly running from $(fpcdir)\packages
Test program generates correct dest.jpg
(0071746)
Michael Van Canneyt (administrator)
2013-12-03 14:06

Applied the patch, thank you.
(0071747)
ocean (reporter)
2013-12-03 15:43

Thanks
(0073420)
Jonas Maebe (manager)
2014-03-04 16:24

Merged to 2.6.4 in spite of 2.8.0 target version

- 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
2013-09-18 11:33 ocean Note Added: 0070152
2013-09-18 11:33 ocean Status feedback => assigned
2013-12-02 10:42 Reinier Olislagers Note Added: 0071725
2013-12-02 16:56 Bart Broersma Project Patches => FPC
2013-12-03 13:22 Reinier Olislagers Note Added: 0071745
2013-12-03 13:22 Reinier Olislagers Assigned To Mattias Gaertner =>
2013-12-03 13:22 Reinier Olislagers Status assigned => confirmed
2013-12-03 13:32 Michael Van Canneyt Assigned To => Michael Van Canneyt
2013-12-03 13:32 Michael Van Canneyt Status confirmed => assigned
2013-12-03 14:06 Michael Van Canneyt Fixed in Revision => 26171
2013-12-03 14:06 Michael Van Canneyt Note Added: 0071746
2013-12-03 14:06 Michael Van Canneyt Status assigned => resolved
2013-12-03 14:06 Michael Van Canneyt Fixed in Version => 2.7.1
2013-12-03 14:06 Michael Van Canneyt Resolution open => fixed
2013-12-03 14:06 Michael Van Canneyt Target Version => 2.8.0
2013-12-03 15:43 ocean Note Added: 0071747
2013-12-03 15:43 ocean Status resolved => closed
2014-03-04 16:24 Jonas Maebe Fixed in Revision 26171 => 26325
2014-03-04 16:24 Jonas Maebe Note Added: 0073420
2014-03-04 16:24 Jonas Maebe Fixed in Version 2.7.1 => 2.6.4



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