View Issue Details

IDProjectCategoryView StatusLast Update
0001903ScribusOS-PPCOSXpublic2013-09-04 20:55
Reporterwordtech Assigned Tocbradney  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformPPCOSOS XOS Version10.3.8
Product Version1.3.0cvs 
Target VersionFixed in Version 
Summary0001903: PDF export issue with JPEG color on OSX Aqua
DescriptionColor in exported JPEGs does not reproduce correctly. Grayscale jpegs appear with a blueish cast. RGB JPEGS also appear blueish in tone.

Exporting a page as a graphic (PNG) reproduces the color correctly.
Steps To ReproduceUse pre-alpha Scribus/Aqua build.
Import JPEG.
Export as PDF with default settings, with color configured for "printer."
View PDF.
Additional InformationThe attached zip file includes two jpegs to illustrate the problem. "Cover-from-pdf.jpg" has the bluish cast in the photos. "Cover-from-png.jpg" has the correct colors: the grayscale photo reproduces as grayscale, and the front cover photo retains its full color range, including reds and yellows. The source file is > 17 mb, and cannot be uploaded.
TagsNo tags attached.
Patch

Relationships

related to 0002015 closedavox This issue lists all known regressions of the Aqua port compared with the 13 Linux version 
related to 0002064 assignedfschmid Importing of cmyk tiffs with 16bit depth does not work 
child of 0004413 acknowledged Metabug: Colors 

Activities

2005-04-22 01:18

 

covers.zip (163,675 bytes)

fschmid

2005-04-22 03:50

administrator   ~0004356

Is it possible to upload at least a small sample pdf with these jpg files? If not, what are your settings when you export to pdf?

cbradney

2005-04-22 07:13

administrator   ~0004357

Is it possible for you to upload the source file for us to test to a website? or if not, please email directly to me.. cbradney@scribus.info.

2005-04-22 21:12

 

perfectmatch.jpg (164,553 bytes)
perfectmatch.jpg (164,553 bytes)

cbradney

2005-04-22 21:12

administrator   ~0004369

Looks ok here on Linux. Endian issue?

2005-05-26 14:38

 

scimage.diff (6,737 bytes)
Index: scribus/scimage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/scimage.cpp,v
retrieving revision 1.1.2.16
diff -u -p -r1.1.2.16 scimage.cpp
--- scribus/scimage.cpp	7 May 2005 15:14:39 -0000	1.1.2.16
+++ scribus/scimage.cpp	22 May 2005 21:11:28 -0000
@@ -872,10 +876,10 @@ QString ScImage::ImageToCMYK()
 			int y = 255 - qBlue(r);
 			int k = QMIN(QMIN(c, m), y);
 			*s = qRgba(m - k, y - k, k, c - k);
-			ImgStr += c - k;
-			ImgStr += m - k;
-			ImgStr += y - k;
-			ImgStr += k;
+			ImgStr += static_cast<char> (c - k);
+			ImgStr += static_cast<char> (m - k);
+			ImgStr += static_cast<char> (y - k);
+			ImgStr += static_cast<char> (k);
 			s++;
 		}
 	}
@@ -920,10 +924,10 @@ QString ScImage::ImageToCMYK_PDF(bool pr
 				int y = qBlue(r);
 				int k = qAlpha(r);
 				/*				*s = qRgba(m, y, k, c); */
-				ImgStr += c;
-				ImgStr += m;
-				ImgStr += y;
-				ImgStr += k;
+				ImgStr += static_cast<char> (c);
+				ImgStr += static_cast<char> (m);
+				ImgStr += static_cast<char> (y);
+				ImgStr += static_cast<char> (k);
 				s++;
 			}
 		}
@@ -941,15 +945,15 @@ QString ScImage::ImageToCMYK_PDF(bool pr
 				int y = 255 - qBlue(r);
 				int k = QMIN(QMIN(c, m), y);
 				//				*s = qRgba(m, y, k, c);
-				*s = qRgba(c, m, y, k);
-				ImgStr += c - k;
-				ImgStr += m - k;
-				ImgStr += y - k;
-				ImgStr += k;
+//				*s = qRgba(c, m, y, k);
+				ImgStr += static_cast<char> (c - k);
+				ImgStr += static_cast<char> (m - k);
+				ImgStr += static_cast<char> (y - k);
+				ImgStr += static_cast<char> (k);
 				s++;
 			}
 		}
 	}
 	return ImgStr;
 }
 
@@ -972,23 +977,23 @@ QString ScImage::ImageToCMYK_PS(int pl, 
 				int k = qAlpha(r);
 				if (pl == -1)
 				{
-					ImgStr += c;
-					ImgStr += m;
-					ImgStr += y;
-					ImgStr += k;
+					ImgStr += static_cast<char> (c);
+					ImgStr += static_cast<char> (m);
+					ImgStr += static_cast<char> (y);
+					ImgStr += static_cast<char> (k);
 				}
 				else
 				{
 					if (pl == -2)
-						ImgStr += QMIN(255, qRound(0.3 * c + 0.59 * m + 0.11 * y + k));
+						ImgStr += static_cast<char> (QMIN(255, qRound(0.3 * c + 0.59 * m + 0.11 * y + k)));
 					if (pl == 1)
-						ImgStr += c;
+						ImgStr += static_cast<char> (c);
 					if (pl == 2)
-						ImgStr += m;
+						ImgStr += static_cast<char> (m);
 					if (pl == 3)
-						ImgStr += y;
+						ImgStr += static_cast<char> (y);
 					if (pl == 0)
-						ImgStr += k;
+						ImgStr += static_cast<char> (k);
 				}
 			}
 		}
@@ -1007,27 +1012,27 @@ QString ScImage::ImageToCMYK_PS(int pl, 
 				int k = QMIN(QMIN(c, m), y);
 				if (pl == -1)
 				{
-					ImgStr += c - k;
-					ImgStr += m - k;
-					ImgStr += y - k;
-					ImgStr += k;
+					ImgStr += static_cast<char> (c - k);
+					ImgStr += static_cast<char> (m - k);
+					ImgStr += static_cast<char> (y - k);
+					ImgStr += static_cast<char> (k);
 				}
 				else
 				{
 					if (pl == -2)
-						ImgStr += QMIN(255, qRound(0.3 * c + 0.59 * m + 0.11 * y + k));
+						ImgStr += static_cast<char> (QMIN(255, qRound(0.3 * c + 0.59 * m + 0.11 * y + k)));
 					if (pl == 1)
-						ImgStr += c - k;
+						ImgStr += static_cast<char> (c - k);
 					if (pl == 2)
-						ImgStr += m - k;
+						ImgStr += static_cast<char> (m - k);
 					if (pl == 3)
-						ImgStr += y - k;
+						ImgStr += static_cast<char> (y - k);
 					if (pl == 0)
-						ImgStr += k;
+						ImgStr += static_cast<char> (k);
 				}
 			}
 		}
 	}
 	return ImgStr;
 }
 
@@ -2775,10 +2781,12 @@ bool ScImage::LoadPicture(QString fn, QS
 					for( int yi=0; yi < hi; ++yi )
 					{
 						QRgb *s = (QRgb*)(image.scanLine( yi ));
+						QRgb alphaFF = qRgba(255,255,255,255);
+						QRgb alpha00 = qRgba(255,255,255,  0);
 						for(int xi=0; xi < wi; ++xi )
 						{
-							if((*s) == 0xffffffff)
-								(*s) &= 0x00ffffff;
+							if((*s) == alphaFF)
+								(*s) &= alpha00;
 							s++;
 						}
 					}
@@ -3130,7 +3138,7 @@ bool ScImage::LoadPicture(QString fn, QS
 			{
 				for (int i = 0; i < height(); i++)
 				{
-					unsigned int *ptr = (unsigned int *) scanLine(i);
+					QRgb *ptr = (QRgb*) scanLine(i);
 					unsigned char c, m, y ,k;
 					if ((cinfo.jpeg_color_space == JCS_YCCK) || ((cinfo.jpeg_color_space == JCS_CMYK) && (cinfo.saw_Adobe_marker)))
 					{
@@ -3141,10 +3149,7 @@ bool ScImage::LoadPicture(QString fn, QS
 							m = p[1];
 							y =  p[2];
 							k =  p[3];
-							p[0] = 255 - y;
-							p[1] = 255 - m;
-							p[2] = 255 - c;
-							p[3] = 255 - k;
+							*ptr = qRgba(255 - y, 255 - m, 255 - c, 255 - k);
 							ptr++;
 						}
 					}
@@ -3157,10 +3162,7 @@ bool ScImage::LoadPicture(QString fn, QS
 							m = p[1];
 							y =  p[2];
 							k =  p[3];
-							p[0] = y;
-							p[1] = m;
-							p[2] = c;
-							p[3] = k;
+							*ptr = qRgba(y, m, c, k);
 							ptr++;
 						}
 					}
@@ -3283,9 +3285,10 @@ bool ScImage::LoadPicture(QString fn, QS
 				// which will still contain the black channel
 				if (isCMYK && requestType != 0 && !bilevel)
 				{
-					unsigned int *p = (unsigned int *) ptr;
+					QRgb *p = (QRgb *) ptr;
+					QRgb alphaFF = qRgba(0,0,0,255);
 					for (int j = 0; j < width(); j++, p++)
-						*p |= 0xff000000;
+						*p |= alphaFF;
 				}
 
 			}
@@ -3305,20 +3308,15 @@ bool ScImage::LoadPicture(QString fn, QS
 			{
 				for (int i = 0; i < height(); i++)
 				{
-					unsigned int *ptr = (unsigned int *) scanLine(i);
+					QRgb *ptr = (QRgb *) scanLine(i);
 					unsigned char c, m, y ,k;
 					for (int j = 0; j < width(); j++)
 					{
-						unsigned char *p = (unsigned char *) ptr;
-						c = 255 - p[0];
-						m = 255 - p[1];
-						y = 255 - p[2];
+						c = 255 - qRed(*ptr);
+						m = 255 - qGreen(*ptr);
+						y = 255 - qBlue(*ptr);
 						k = QMIN(QMIN(c, m), y);
-						p[0] = c - k;
-						p[1] = m - k;
-						p[2] = y - k;
-						p[3] = k;
-						ptr++;
+						*ptr++ = qRgba(c,m,y,k);
 					}
 				}
 			}
@@ -3329,19 +3327,15 @@ bool ScImage::LoadPicture(QString fn, QS
 			{
 				for (int i = 0; i < height(); i++)
 				{
-					unsigned int *ptr = (unsigned int *) scanLine(i);
-					unsigned char r, g, b;
+					QRgb *ptr = (QRgb *) scanLine(i);
+					unsigned char r, g, b, k;
 					for (int j = 0; j < width(); j++)
 					{
-						unsigned char *p = (unsigned char *) ptr;
-						r = 255 - QMIN(255, p[0] + p[3]);
-						g = 255 - QMIN(255, p[1] + p[3]);
-						b = 255 - QMIN(255, p[2] + p[3]);
-						p[0] = r;
-						p[1] = g;
-						p[2] = b;
-						p[3] = 255;
-						ptr++;
+						k = qAlpha(*ptr);
+						r = 255 - QMIN(255, qRed(*ptr) + k);
+						g = 255 - QMIN(255, qGreen(*ptr) + k);
+						b = 255 - QMIN(255, qBlue(*ptr) + k);
+						*ptr++ = qRgba(r,g,b,255);
 					}
 				}
 			}
scimage.diff (6,737 bytes)

avox

2005-05-26 14:47

administrator   ~0004786

The attached patch fixes most problems for me. The PS output is too dark, though, as if the K component was added twice.

Haven't changed anything with the TIFF loading code, but I suspect Endianness issues there, also.

I also noticed that the parameters "useEmbedded" and "renderingIntent" for loadPicture() appear to be swapped in pdflib.cpp. Franz?

avox

2007-01-12 21:48

administrator   ~0014781

please test if this problem persists in the 1.3.3.7aqua release candidate:
http://aqua.scribus.net/ScribusAqua-2007-01-12.tar.gz
This is a bundle which contains all needed libraries, built on 10.4.8.

Issue History

Date Modified Username Field Change
2005-04-22 01:18 wordtech New Issue
2005-04-22 01:18 wordtech File Added: covers.zip
2005-04-22 03:50 fschmid Note Added: 0004356
2005-04-22 07:13 cbradney Note Added: 0004357
2005-04-22 20:34 cbradney Summary PDF export => PDF export issue with JPEG color on OSX Aqua
2005-04-22 21:12 cbradney File Added: perfectmatch.jpg
2005-04-22 21:12 cbradney Note Added: 0004369
2005-05-15 21:51 plinnell Assigned To => avox
2005-05-15 21:51 plinnell Status new => assigned
2005-05-26 14:38 avox File Added: scimage.diff
2005-05-26 14:47 avox Note Added: 0004786
2005-05-26 14:47 avox Assigned To avox => fschmid
2005-05-26 18:28 mhanski Relationship added related to 0002015
2005-06-06 11:48 cbradney Category Import / Export => MacOSX
2005-10-01 11:17 avox Relationship added related to 0002064
2006-10-14 22:17 mhanski Relationship added child of 0004413
2007-01-12 21:48 avox Note Added: 0014781
2007-01-12 21:48 avox Assigned To fschmid => avox
2007-01-12 21:48 avox Status assigned => feedback
2013-09-04 20:55 cbradney Status feedback => resolved
2013-09-04 20:55 cbradney Resolution open => fixed
2013-09-04 20:55 cbradney Status resolved => closed
2013-09-04 20:55 cbradney Assigned To avox => cbradney
2014-10-08 18:38 Kunda Category PPCOSX => OS-PPCOSX