Changeset 3872
- Timestamp:
- 03/14/11 14:46:46 (2 years ago)
- File:
-
- 1 edited
-
ImageMagick/trunk/coders/png.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/coders/png.c
r3845 r3872 1968 1968 } 1969 1969 #endif 1970 1970 1971 if (png_get_valid(ping,ping_info,PNG_INFO_PLTE)) 1971 1972 { … … 2884 2885 (void) ConcatenateMagickString(value,text[i].text,length+2); 2885 2886 2886 /* Don't save "density" property if we have a pHYs chunk */ 2887 if (LocaleCompare(text[i].key,"density") != 0 || 2888 !png_get_valid(ping,ping_info,PNG_INFO_pHYs)) 2887 /* Don't save "density" or "units" property if we have a pHYs 2888 * chunk 2889 */ 2890 if (!png_get_valid(ping,ping_info,PNG_INFO_pHYs) || 2891 (LocaleCompare(text[i].key,"density") != 0 && 2892 LocaleCompare(text[i].key,"units") != 0)) 2889 2893 (void) SetImageProperty(image,text[i].key,value); 2890 2894 … … 7859 7863 { 7860 7864 ping_pHYs_unit_type=PNG_RESOLUTION_METER; 7861 ping_pHYs_x_resolution=(png_uint_32) (100.0*image->x_resolution/2.54); 7862 ping_pHYs_y_resolution=(png_uint_32) (100.0*image->y_resolution/2.54); 7865 ping_pHYs_x_resolution= 7866 (png_uint_32) ((100.0*image->x_resolution+0.5)/2.54); 7867 ping_pHYs_y_resolution= 7868 (png_uint_32) ((100.0*image->y_resolution+0.5)/2.54); 7863 7869 } 7864 7870 … … 7866 7872 { 7867 7873 ping_pHYs_unit_type=PNG_RESOLUTION_METER; 7868 ping_pHYs_x_resolution=(png_uint_32) (100.0*image->x_resolution );7869 ping_pHYs_y_resolution=(png_uint_32) (100.0*image->y_resolution );7874 ping_pHYs_x_resolution=(png_uint_32) (100.0*image->x_resolution+0.5); 7875 ping_pHYs_y_resolution=(png_uint_32) (100.0*image->y_resolution+0.5); 7870 7876 } 7871 7877 … … 7877 7883 } 7878 7884 7885 if (logging != MagickFalse) 7886 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 7887 " Set up PNG pHYs chunk: xres: %.20g, yres: %.20g, units: %d.", 7888 (double) ping_pHYs_x_resolution,(double) ping_pHYs_y_resolution, 7889 (int) ping_pHYs_unit_type); 7879 7890 ping_have_pHYs = MagickTrue; 7880 7891 } … … 8663 8674 } 8664 8675 8665 if (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse) 8676 if ((ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse) && 8677 (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse)) 8666 8678 { 8667 8679 ResetImageProfileIterator(image); … … 8915 8927 ping_pHYs_y_resolution, 8916 8928 ping_pHYs_unit_type); 8929 8930 if (logging) 8931 { 8932 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 8933 " Setting up pHYs chunk"); 8934 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 8935 " x_resolution=%lu", 8936 (unsigned long) ping_pHYs_x_resolution); 8937 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 8938 " y_resolution=%lu", 8939 (unsigned long) ping_pHYs_y_resolution); 8940 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 8941 " unit_type=%lu", 8942 (unsigned long) ping_pHYs_unit_type); 8943 } 8917 8944 } 8918 8945 } … … 9389 9416 Generate text chunks. 9390 9417 */ 9391 if (ping_exclude_tEXt == MagickFalse &&ping_exclude_zTXt == MagickFalse)9418 if (ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse) 9392 9419 { 9393 9420 ResetImagePropertyIterator(image); … … 9399 9426 9400 9427 value=GetImageProperty(image,property); 9401 if (LocaleCompare(property,"density") != 0 || 9402 ping_exclude_pHYs != MagickFalse) 9428 if (ping_exclude_pHYs != MagickFalse || 9429 LocaleCompare(property,"density") != 0 || 9430 LocaleCompare(property,"units") != 0) 9403 9431 { 9404 9432 if (value != (const char *) NULL)
Note: See TracChangeset
for help on using the changeset viewer.
