cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % IIIII DDDD EEEEE N N TTTTT IIIII FFFFF Y Y % |
| 7 | % I D D E NN N T I F Y Y % |
| 8 | % I D D EEE N N N T I FFF Y % |
| 9 | % I D D E N NN T I F Y % |
| 10 | % IIIII DDDD EEEEE N N T IIIII F Y % |
| 11 | % % |
| 12 | % % |
| 13 | % Identify an Image Format and Characteristics. % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % September 1994 % |
| 18 | % % |
| 19 | % % |
| 20 | % Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization % |
| 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 28 | % Unless required by applicable law or agreed to in writing, software % |
| 29 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 30 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 31 | % See the License for the specific language governing permissions and % |
| 32 | % limitations under the License. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 36 | % Identify describes the format and characteristics of one or more image |
| 37 | % files. It will also report if an image is incomplete or corrupt. |
| 38 | % |
| 39 | % |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | Include declarations. |
| 44 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 45 | #include "MagickCore/studio.h" |
| 46 | #include "MagickCore/annotate.h" |
| 47 | #include "MagickCore/artifact.h" |
| 48 | #include "MagickCore/attribute.h" |
| 49 | #include "MagickCore/blob.h" |
| 50 | #include "MagickCore/cache.h" |
| 51 | #include "MagickCore/client.h" |
| 52 | #include "MagickCore/coder.h" |
| 53 | #include "MagickCore/color.h" |
| 54 | #include "MagickCore/configure.h" |
| 55 | #include "MagickCore/constitute.h" |
| 56 | #include "MagickCore/decorate.h" |
| 57 | #include "MagickCore/delegate.h" |
| 58 | #include "MagickCore/draw.h" |
| 59 | #include "MagickCore/effect.h" |
| 60 | #include "MagickCore/exception.h" |
| 61 | #include "MagickCore/exception-private.h" |
| 62 | #include "MagickCore/feature.h" |
| 63 | #include "MagickCore/gem.h" |
| 64 | #include "MagickCore/geometry.h" |
| 65 | #include "MagickCore/histogram.h" |
| 66 | #include "MagickCore/identify.h" |
| 67 | #include "MagickCore/image.h" |
| 68 | #include "MagickCore/image-private.h" |
| 69 | #include "MagickCore/list.h" |
| 70 | #include "MagickCore/locale_.h" |
| 71 | #include "MagickCore/log.h" |
| 72 | #include "MagickCore/magic.h" |
| 73 | #include "MagickCore/magick.h" |
| 74 | #include "MagickCore/memory_.h" |
| 75 | #include "MagickCore/module.h" |
| 76 | #include "MagickCore/monitor.h" |
| 77 | #include "MagickCore/montage.h" |
| 78 | #include "MagickCore/option.h" |
| 79 | #include "MagickCore/pixel-accessor.h" |
| 80 | #include "MagickCore/prepress.h" |
| 81 | #include "MagickCore/profile.h" |
| 82 | #include "MagickCore/property.h" |
| 83 | #include "MagickCore/quantize.h" |
| 84 | #include "MagickCore/quantum.h" |
| 85 | #include "MagickCore/random_.h" |
| 86 | #include "MagickCore/registry.h" |
| 87 | #include "MagickCore/resize.h" |
| 88 | #include "MagickCore/resource_.h" |
| 89 | #include "MagickCore/signature.h" |
| 90 | #include "MagickCore/statistic.h" |
| 91 | #include "MagickCore/string_.h" |
| 92 | #include "MagickCore/string-private.h" |
| 93 | #include "MagickCore/timer.h" |
| 94 | #include "MagickCore/utility.h" |
| 95 | #include "MagickCore/version.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 96 | #if defined(MAGICKCORE_LCMS_DELEGATE) |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 97 | #if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H) |
| 98 | #include <lcms/lcms2.h> |
| 99 | #elif defined(MAGICKCORE_HAVE_LCMS2_H) |
| 100 | #include "lcms2.h" |
| 101 | #elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 102 | #include <lcms/lcms.h> |
| 103 | #else |
| 104 | #include "lcms.h" |
| 105 | #endif |
| 106 | #endif |
| 107 | |
| 108 | /* |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 109 | Define declarations. |
| 110 | */ |
| 111 | #if defined(MAGICKCORE_LCMS_DELEGATE) |
| 112 | #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000) |
| 113 | #define cmsUInt32Number DWORD |
| 114 | #endif |
| 115 | #endif |
| 116 | |
| 117 | /* |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 118 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 119 | % % |
| 120 | % % |
| 121 | % % |
| 122 | % I d e n t i f y I m a g e % |
| 123 | % % |
| 124 | % % |
| 125 | % % |
| 126 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 127 | % |
| 128 | % IdentifyImage() identifies an image by printing its attributes to the file. |
| 129 | % Attributes include the image width, height, size, and others. |
| 130 | % |
| 131 | % The format of the IdentifyImage method is: |
| 132 | % |
| 133 | % MagickBooleanType IdentifyImage(Image *image,FILE *file, |
| 134 | % const MagickBooleanType verbose) |
| 135 | % |
| 136 | % A description of each parameter follows: |
| 137 | % |
| 138 | % o image: the image. |
| 139 | % |
| 140 | % o file: the file, typically stdout. |
| 141 | % |
| 142 | % o verbose: A value other than zero prints more detailed information |
| 143 | % about the image. |
| 144 | % |
| 145 | */ |
| 146 | |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 147 | static ssize_t PrintChannelFeatures(FILE *file,const ChannelType channel, |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 148 | const char *name,const ChannelFeatures *channel_features) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 149 | { |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 150 | #define PrintFeature(feature) \ |
| 151 | GetMagickPrecision(),(feature)[0], \ |
| 152 | GetMagickPrecision(),(feature)[1], \ |
| 153 | GetMagickPrecision(),(feature)[2], \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 154 | GetMagickPrecision(),(feature)[3], \ |
| 155 | GetMagickPrecision(),((feature)[0]+(feature)[1]+(feature)[2]+(feature)[3])/4.0 \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 156 | |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 157 | #define FeaturesFormat " %s:\n" \ |
cristy | cdf8e1b | 2010-01-28 01:52:33 +0000 | [diff] [blame] | 158 | " Angular Second Moment:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 159 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | cdf8e1b | 2010-01-28 01:52:33 +0000 | [diff] [blame] | 160 | " Contrast:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 161 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | cdf8e1b | 2010-01-28 01:52:33 +0000 | [diff] [blame] | 162 | " Correlation:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 163 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 164 | " Sum of Squares: Variance:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 165 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | cf5e649 | 2010-01-28 02:45:28 +0000 | [diff] [blame] | 166 | " Inverse Difference Moment:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 167 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 168 | " Sum Average:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 169 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 170 | " Sum Variance:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 171 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 172 | " Sum Entropy:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 173 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 174 | " Entropy:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 175 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 176 | " Difference Variance:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 177 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e0e19dc | 2010-01-29 02:13:08 +0000 | [diff] [blame] | 178 | " Difference Entropy:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 179 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e0e19dc | 2010-01-29 02:13:08 +0000 | [diff] [blame] | 180 | " Information Measure of Correlation 1:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 181 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e0e19dc | 2010-01-29 02:13:08 +0000 | [diff] [blame] | 182 | " Information Measure of Correlation 2:\n" \ |
cristy | e0acabf | 2010-01-30 00:52:38 +0000 | [diff] [blame] | 183 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ |
cristy | e0e19dc | 2010-01-29 02:13:08 +0000 | [diff] [blame] | 184 | " Maximum Correlation Coefficient:\n" \ |
cristy | c3ec0d4 | 2010-04-07 01:18:08 +0000 | [diff] [blame] | 185 | " %.*g, %.*g, %.*g, %.*g, %.*g\n" |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 186 | |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 187 | ssize_t |
| 188 | n; |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 189 | |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 190 | n=FormatLocaleFile(file,FeaturesFormat,name, |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 191 | PrintFeature(channel_features[channel].angular_second_moment), |
| 192 | PrintFeature(channel_features[channel].contrast), |
| 193 | PrintFeature(channel_features[channel].correlation), |
| 194 | PrintFeature(channel_features[channel].variance_sum_of_squares), |
| 195 | PrintFeature(channel_features[channel].inverse_difference_moment), |
| 196 | PrintFeature(channel_features[channel].sum_average), |
| 197 | PrintFeature(channel_features[channel].sum_variance), |
| 198 | PrintFeature(channel_features[channel].sum_entropy), |
| 199 | PrintFeature(channel_features[channel].entropy), |
cristy | e0e19dc | 2010-01-29 02:13:08 +0000 | [diff] [blame] | 200 | PrintFeature(channel_features[channel].difference_variance), |
| 201 | PrintFeature(channel_features[channel].difference_entropy), |
| 202 | PrintFeature(channel_features[channel].measure_of_correlation_1), |
| 203 | PrintFeature(channel_features[channel].measure_of_correlation_2), |
| 204 | PrintFeature(channel_features[channel].maximum_correlation_coefficient)); |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 205 | return(n); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 206 | } |
| 207 | |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 208 | static ssize_t PrintChannelStatistics(FILE *file,const ChannelType channel, |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 209 | const char *name,const double scale, |
| 210 | const ChannelStatistics *channel_statistics) |
| 211 | { |
| 212 | #define StatisticsFormat " %s:\n min: " QuantumFormat \ |
cristy | e7f5109 | 2010-01-17 00:39:37 +0000 | [diff] [blame] | 213 | " (%g)\n max: " QuantumFormat " (%g)\n" \ |
| 214 | " mean: %g (%g)\n standard deviation: %g (%g)\n" \ |
| 215 | " kurtosis: %g\n skewness: %g\n" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 216 | |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 217 | ssize_t |
| 218 | n; |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 219 | |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 220 | n=FormatLocaleFile(file,StatisticsFormat,name,ClampToQuantum(scale* |
cristy | a45da3b | 2010-03-31 02:06:45 +0000 | [diff] [blame] | 221 | channel_statistics[channel].minima),channel_statistics[channel].minima/ |
| 222 | (double) QuantumRange,ClampToQuantum(scale* |
| 223 | channel_statistics[channel].maxima),channel_statistics[channel].maxima/ |
| 224 | (double) QuantumRange,scale*channel_statistics[channel].mean, |
| 225 | channel_statistics[channel].mean/(double) QuantumRange,scale* |
| 226 | channel_statistics[channel].standard_deviation, |
cristy | 75b5a25 | 2010-02-26 02:40:46 +0000 | [diff] [blame] | 227 | channel_statistics[channel].standard_deviation/(double) QuantumRange, |
| 228 | channel_statistics[channel].kurtosis,channel_statistics[channel].skewness); |
cristy | 20ec759 | 2011-05-29 01:28:05 +0000 | [diff] [blame] | 229 | return(n); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, |
| 233 | const MagickBooleanType verbose) |
| 234 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 235 | char |
| 236 | color[MaxTextExtent], |
| 237 | format[MaxTextExtent], |
| 238 | key[MaxTextExtent]; |
| 239 | |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 240 | ChannelFeatures |
| 241 | *channel_features; |
| 242 | |
| 243 | ChannelStatistics |
| 244 | *channel_statistics; |
| 245 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 246 | ColorspaceType |
| 247 | colorspace; |
| 248 | |
| 249 | const char |
| 250 | *artifact, |
| 251 | *name, |
| 252 | *property, |
| 253 | *registry, |
| 254 | *value; |
| 255 | |
| 256 | const MagickInfo |
| 257 | *magick_info; |
| 258 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 259 | double |
| 260 | elapsed_time, |
| 261 | user_time; |
| 262 | |
| 263 | ExceptionInfo |
| 264 | *exception; |
| 265 | |
| 266 | ImageType |
| 267 | type; |
| 268 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 269 | MagickBooleanType |
| 270 | ping; |
| 271 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 272 | register const Quantum |
| 273 | *p; |
| 274 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 275 | register ssize_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 276 | i, |
| 277 | x; |
| 278 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 279 | size_t |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 280 | distance, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 281 | scale; |
| 282 | |
cristy | 9d314ff | 2011-03-09 01:30:28 +0000 | [diff] [blame] | 283 | ssize_t |
| 284 | y; |
| 285 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 286 | assert(image != (Image *) NULL); |
| 287 | assert(image->signature == MagickSignature); |
| 288 | if (image->debug != MagickFalse) |
| 289 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| 290 | if (file == (FILE *) NULL) |
| 291 | file=stdout; |
| 292 | *format='\0'; |
| 293 | elapsed_time=GetElapsedTime(&image->timer); |
| 294 | user_time=GetUserTime(&image->timer); |
| 295 | GetTimerInfo(&image->timer); |
| 296 | if (verbose == MagickFalse) |
| 297 | { |
| 298 | /* |
| 299 | Display summary info about the image. |
| 300 | */ |
| 301 | if (*image->magick_filename != '\0') |
| 302 | if (LocaleCompare(image->magick_filename,image->filename) != 0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 303 | (void) FormatLocaleFile(file,"%s=>",image->magick_filename); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 304 | if ((GetPreviousImageInList(image) == (Image *) NULL) && |
cristy | 81b8ce5 | 2010-02-05 01:53:17 +0000 | [diff] [blame] | 305 | (GetNextImageInList(image) == (Image *) NULL) && |
| 306 | (image->scene == 0)) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 307 | (void) FormatLocaleFile(file,"%s ",image->filename); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 308 | else |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 309 | (void) FormatLocaleFile(file,"%s[%.20g] ",image->filename,(double) |
| 310 | image->scene); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 311 | (void) FormatLocaleFile(file,"%s ",image->magick); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 312 | if ((image->magick_columns != 0) || (image->magick_rows != 0)) |
| 313 | if ((image->magick_columns != image->columns) || |
| 314 | (image->magick_rows != image->rows)) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 315 | (void) FormatLocaleFile(file,"%.20gx%.20g=>",(double) |
| 316 | image->magick_columns,(double) image->magick_rows); |
| 317 | (void) FormatLocaleFile(file,"%.20gx%.20g ",(double) image->columns, |
| 318 | (double) image->rows); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 319 | if ((image->page.width != 0) || (image->page.height != 0) || |
| 320 | (image->page.x != 0) || (image->page.y != 0)) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 321 | (void) FormatLocaleFile(file,"%.20gx%.20g%+.20g%+.20g ",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 322 | image->page.width,(double) image->page.height,(double) image->page.x, |
| 323 | (double) image->page.y); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 324 | (void) FormatLocaleFile(file,"%.20g-bit ",(double) image->depth); |
cristy | 5f1c1ff | 2010-12-23 21:38:06 +0000 | [diff] [blame] | 325 | if (image->type != UndefinedType) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 326 | (void) FormatLocaleFile(file,"%s ",CommandOptionToMnemonic( |
| 327 | MagickTypeOptions,(ssize_t) image->type)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 328 | if (image->storage_class == DirectClass) |
| 329 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 330 | (void) FormatLocaleFile(file,"DirectClass "); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 331 | if (image->total_colors != 0) |
| 332 | { |
cristy | b9080c9 | 2009-12-01 20:13:26 +0000 | [diff] [blame] | 333 | (void) FormatMagickSize(image->total_colors,MagickFalse,format); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 334 | (void) FormatLocaleFile(file,"%s ",format); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 335 | } |
| 336 | } |
| 337 | else |
| 338 | if (image->total_colors <= image->colors) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 339 | (void) FormatLocaleFile(file,"PseudoClass %.20gc ",(double) |
| 340 | image->colors); |
cristy | f2faecf | 2010-05-28 19:19:36 +0000 | [diff] [blame] | 341 | else |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 342 | (void) FormatLocaleFile(file,"PseudoClass %.20g=>%.20gc ",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 343 | image->total_colors,(double) image->colors); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 344 | if (image->error.mean_error_per_pixel != 0.0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 345 | (void) FormatLocaleFile(file,"%.20g/%f/%fdb ",(double) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 346 | (image->error.mean_error_per_pixel+0.5), |
| 347 | image->error.normalized_mean_error, |
| 348 | image->error.normalized_maximum_error); |
| 349 | if (GetBlobSize(image) != 0) |
| 350 | { |
cristy | b9080c9 | 2009-12-01 20:13:26 +0000 | [diff] [blame] | 351 | (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 352 | (void) FormatLocaleFile(file,"%s ",format); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 353 | } |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 354 | (void) FormatLocaleFile(file,"%0.3fu %lu:%02lu.%03lu",user_time, |
| 355 | (unsigned long) (elapsed_time/60.0),(unsigned long) floor(fmod( |
| 356 | elapsed_time,60.0)),(unsigned long) (1000.0*(elapsed_time- |
| 357 | floor(elapsed_time)))); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 358 | (void) FormatLocaleFile(file,"\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 359 | (void) fflush(file); |
| 360 | return(ferror(file) != 0 ? MagickFalse : MagickTrue); |
| 361 | } |
| 362 | /* |
| 363 | Display verbose info about the image. |
| 364 | */ |
| 365 | exception=AcquireExceptionInfo(); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 366 | p=GetVirtualPixels(image,0,0,1,1,exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 367 | exception=DestroyExceptionInfo(exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 368 | ping=p == (const Quantum *) NULL ? MagickTrue : MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 369 | type=GetImageType(image,&image->exception); |
| 370 | (void) SignatureImage(image); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 371 | (void) FormatLocaleFile(file,"Image: %s\n",image->filename); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 372 | if (*image->magick_filename != '\0') |
| 373 | if (LocaleCompare(image->magick_filename,image->filename) != 0) |
| 374 | { |
| 375 | char |
| 376 | filename[MaxTextExtent]; |
| 377 | |
| 378 | GetPathComponent(image->magick_filename,TailPath,filename); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 379 | (void) FormatLocaleFile(file," Base filename: %s\n",filename); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 380 | } |
| 381 | magick_info=GetMagickInfo(image->magick,&image->exception); |
| 382 | if ((magick_info == (const MagickInfo *) NULL) || |
| 383 | (*GetMagickDescription(magick_info) == '\0')) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 384 | (void) FormatLocaleFile(file," Format: %s\n",image->magick); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 385 | else |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 386 | (void) FormatLocaleFile(file," Format: %s (%s)\n",image->magick, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 387 | GetMagickDescription(magick_info)); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 388 | (void) FormatLocaleFile(file," Class: %s\n",CommandOptionToMnemonic( |
| 389 | MagickClassOptions,(ssize_t) image->storage_class)); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 390 | (void) FormatLocaleFile(file," Geometry: %.20gx%.20g%+.20g%+.20g\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 391 | image->columns,(double) image->rows,(double) image->tile_offset.x,(double) |
| 392 | image->tile_offset.y); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 393 | if ((image->magick_columns != 0) || (image->magick_rows != 0)) |
| 394 | if ((image->magick_columns != image->columns) || |
| 395 | (image->magick_rows != image->rows)) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 396 | (void) FormatLocaleFile(file," Base geometry: %.20gx%.20g\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 397 | image->magick_columns,(double) image->magick_rows); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 398 | if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0)) |
| 399 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 400 | (void) FormatLocaleFile(file," Resolution: %gx%g\n",image->x_resolution, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 401 | image->y_resolution); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 402 | (void) FormatLocaleFile(file," Print size: %gx%g\n",(double) |
| 403 | image->columns/image->x_resolution,(double) image->rows/ |
| 404 | image->y_resolution); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 405 | } |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 406 | (void) FormatLocaleFile(file," Units: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 407 | MagickResolutionOptions,(ssize_t) image->units)); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 408 | (void) FormatLocaleFile(file," Type: %s\n",CommandOptionToMnemonic( |
| 409 | MagickTypeOptions,(ssize_t) type)); |
cristy | 5f1c1ff | 2010-12-23 21:38:06 +0000 | [diff] [blame] | 410 | if (image->type != UndefinedType) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 411 | (void) FormatLocaleFile(file," Base type: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 412 | MagickTypeOptions,(ssize_t) image->type)); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 413 | (void) FormatLocaleFile(file," Endianess: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 414 | MagickEndianOptions,(ssize_t) image->endian)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 415 | /* |
| 416 | Detail channel depth and extrema. |
| 417 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 418 | (void) FormatLocaleFile(file," Colorspace: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 419 | MagickColorspaceOptions,(ssize_t) image->colorspace)); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 420 | channel_statistics=(ChannelStatistics *) NULL; |
cristy | 15a8878 | 2010-01-31 23:24:49 +0000 | [diff] [blame] | 421 | channel_features=(ChannelFeatures *) NULL; |
| 422 | colorspace=image->colorspace; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 423 | if (ping == MagickFalse) |
| 424 | { |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 425 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 426 | depth; |
| 427 | |
cristy | 15a8878 | 2010-01-31 23:24:49 +0000 | [diff] [blame] | 428 | channel_statistics=GetImageChannelStatistics(image,&image->exception); |
| 429 | artifact=GetImageArtifact(image,"identify:features"); |
| 430 | if (artifact != (const char *) NULL) |
| 431 | { |
| 432 | distance=StringToUnsignedLong(artifact); |
| 433 | channel_features=GetImageChannelFeatures(image,distance, |
| 434 | &image->exception); |
| 435 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 436 | depth=GetImageDepth(image,&image->exception); |
| 437 | if (image->depth == depth) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 438 | (void) FormatLocaleFile(file," Depth: %.20g-bit\n",(double) |
| 439 | image->depth); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 440 | else |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 441 | (void) FormatLocaleFile(file," Depth: %.20g/%.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 442 | image->depth,(double) depth); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 443 | (void) FormatLocaleFile(file," Channel depth:\n"); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 444 | if (IsImageGray(image,&image->exception) != MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 445 | colorspace=GRAYColorspace; |
| 446 | switch (colorspace) |
| 447 | { |
| 448 | case RGBColorspace: |
| 449 | default: |
| 450 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 451 | (void) FormatLocaleFile(file," red: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 452 | channel_statistics[RedChannel].depth); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 453 | (void) FormatLocaleFile(file," green: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 454 | channel_statistics[GreenChannel].depth); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 455 | (void) FormatLocaleFile(file," blue: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 456 | channel_statistics[BlueChannel].depth); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 457 | break; |
| 458 | } |
| 459 | case CMYKColorspace: |
| 460 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 461 | (void) FormatLocaleFile(file," cyan: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 462 | channel_statistics[CyanChannel].depth); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 463 | (void) FormatLocaleFile(file," magenta: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 464 | channel_statistics[MagentaChannel].depth); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 465 | (void) FormatLocaleFile(file," yellow: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 466 | channel_statistics[YellowChannel].depth); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 467 | (void) FormatLocaleFile(file," black: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 468 | channel_statistics[BlackChannel].depth); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 469 | break; |
| 470 | } |
| 471 | case GRAYColorspace: |
| 472 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 473 | (void) FormatLocaleFile(file," gray: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 474 | channel_statistics[GrayChannel].depth); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 475 | break; |
| 476 | } |
| 477 | } |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 478 | if (image->matte != MagickFalse) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 479 | (void) FormatLocaleFile(file," alpha: %.20g-bit\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 480 | channel_statistics[OpacityChannel].depth); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 481 | scale=1; |
| 482 | if (image->depth <= MAGICKCORE_QUANTUM_DEPTH) |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 483 | scale=QuantumRange/((size_t) QuantumRange >> ((size_t) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 484 | MAGICKCORE_QUANTUM_DEPTH-image->depth)); |
cristy | 15a8878 | 2010-01-31 23:24:49 +0000 | [diff] [blame] | 485 | } |
| 486 | if (channel_statistics != (ChannelStatistics *) NULL) |
| 487 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 488 | (void) FormatLocaleFile(file," Channel statistics:\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 489 | switch (colorspace) |
| 490 | { |
| 491 | case RGBColorspace: |
| 492 | default: |
| 493 | { |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 494 | (void) PrintChannelStatistics(file,RedChannel,"Red",1.0/scale, |
| 495 | channel_statistics); |
| 496 | (void) PrintChannelStatistics(file,GreenChannel,"Green",1.0/scale, |
| 497 | channel_statistics); |
| 498 | (void) PrintChannelStatistics(file,BlueChannel,"Blue",1.0/scale, |
| 499 | channel_statistics); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 500 | break; |
| 501 | } |
| 502 | case CMYKColorspace: |
| 503 | { |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 504 | (void) PrintChannelStatistics(file,CyanChannel,"Cyan",1.0/scale, |
| 505 | channel_statistics); |
| 506 | (void) PrintChannelStatistics(file,MagentaChannel,"Magenta",1.0/scale, |
| 507 | channel_statistics); |
| 508 | (void) PrintChannelStatistics(file,YellowChannel,"Yellow",1.0/scale, |
| 509 | channel_statistics); |
| 510 | (void) PrintChannelStatistics(file,BlackChannel,"Black",1.0/scale, |
| 511 | channel_statistics); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 512 | break; |
| 513 | } |
| 514 | case GRAYColorspace: |
| 515 | { |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 516 | (void) PrintChannelStatistics(file,GrayChannel,"Gray",1.0/scale, |
| 517 | channel_statistics); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 518 | break; |
| 519 | } |
| 520 | } |
| 521 | if (image->matte != MagickFalse) |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 522 | (void) PrintChannelStatistics(file,AlphaChannel,"Alpha",1.0/scale, |
| 523 | channel_statistics); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 524 | if (colorspace != GRAYColorspace) |
| 525 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 526 | (void) FormatLocaleFile(file," Image statistics:\n"); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 527 | (void) PrintChannelStatistics(file,CompositeChannels,"Overall",1.0/ |
| 528 | scale,channel_statistics); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 529 | } |
| 530 | channel_statistics=(ChannelStatistics *) RelinquishMagickMemory( |
| 531 | channel_statistics); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 532 | } |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 533 | if (channel_features != (ChannelFeatures *) NULL) |
| 534 | { |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 535 | (void) FormatLocaleFile(file," Channel features (horizontal, vertical, " |
| 536 | "left and right diagonals, average):\n"); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 537 | switch (colorspace) |
| 538 | { |
| 539 | case RGBColorspace: |
| 540 | default: |
cristy | 549a37e | 2010-01-26 15:24:15 +0000 | [diff] [blame] | 541 | { |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 542 | (void) PrintChannelFeatures(file,RedChannel,"Red",channel_features); |
| 543 | (void) PrintChannelFeatures(file,GreenChannel,"Green", |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 544 | channel_features); |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 545 | (void) PrintChannelFeatures(file,BlueChannel,"Blue",channel_features); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 546 | break; |
| 547 | } |
| 548 | case CMYKColorspace: |
| 549 | { |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 550 | (void) PrintChannelFeatures(file,CyanChannel,"Cyan",channel_features); |
| 551 | (void) PrintChannelFeatures(file,MagentaChannel,"Magenta", |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 552 | channel_features); |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 553 | (void) PrintChannelFeatures(file,YellowChannel,"Yellow", |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 554 | channel_features); |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 555 | (void) PrintChannelFeatures(file,BlackChannel,"Black", |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 556 | channel_features); |
| 557 | break; |
| 558 | } |
| 559 | case GRAYColorspace: |
| 560 | { |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 561 | (void) PrintChannelFeatures(file,GrayChannel,"Gray",channel_features); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 562 | break; |
| 563 | } |
| 564 | } |
| 565 | if (image->matte != MagickFalse) |
cristy | e189779 | 2010-01-29 02:05:50 +0000 | [diff] [blame] | 566 | (void) PrintChannelFeatures(file,AlphaChannel,"Alpha",channel_features); |
cristy | bd82207 | 2010-01-27 00:30:00 +0000 | [diff] [blame] | 567 | channel_features=(ChannelFeatures *) RelinquishMagickMemory( |
| 568 | channel_features); |
| 569 | } |
| 570 | if (ping == MagickFalse) |
| 571 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 572 | if (image->colorspace == CMYKColorspace) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 573 | (void) FormatLocaleFile(file," Total ink density: %.0f%%\n",100.0* |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 574 | GetImageTotalInkDensity(image)/(double) QuantumRange); |
| 575 | x=0; |
| 576 | if (image->matte != MagickFalse) |
| 577 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 578 | register const Quantum |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 579 | *p; |
| 580 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 581 | p=(const Quantum *) NULL; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 582 | for (y=0; y < (ssize_t) image->rows; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 583 | { |
| 584 | p=GetVirtualPixels(image,0,y,image->columns,1,exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 585 | if (p == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 586 | break; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 587 | for (x=0; x < (ssize_t) image->columns; x++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 588 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 589 | if (GetPixelAlpha(image,p) == (Quantum) TransparentAlpha) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 590 | break; |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 591 | p+=GetPixelChannels(image); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 592 | } |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 593 | if (x < (ssize_t) image->columns) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 594 | break; |
| 595 | } |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 596 | if ((x < (ssize_t) image->columns) || (y < (ssize_t) image->rows)) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 597 | { |
| 598 | char |
| 599 | tuple[MaxTextExtent]; |
| 600 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 601 | PixelInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 602 | pixel; |
| 603 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 604 | GetPixelInfo(image,&pixel); |
| 605 | SetPixelInfo(image,p,&pixel); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 606 | (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple, |
| 607 | &image->exception); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 608 | (void) FormatLocaleFile(file," Alpha: %s ",tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 609 | GetColorTuple(&pixel,MagickTrue,tuple); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 610 | (void) FormatLocaleFile(file," %s\n",tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 611 | } |
| 612 | } |
cristy | 83fae87 | 2010-04-22 15:04:16 +0000 | [diff] [blame] | 613 | artifact=GetImageArtifact(image,"identify:unique-colors"); |
cristy | 5f78e80 | 2011-01-31 20:02:41 +0000 | [diff] [blame] | 614 | if (IsHistogramImage(image,&image->exception) != MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 615 | { |
cristy | 4c96756 | 2011-06-16 01:46:57 +0000 | [diff] [blame] | 616 | (void) FormatLocaleFile(file," Colors: %.20g\n",(double) |
| 617 | GetNumberColors(image,(FILE *) NULL,&image->exception)); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 618 | (void) FormatLocaleFile(file," Histogram:\n"); |
cristy | 549a37e | 2010-01-26 15:24:15 +0000 | [diff] [blame] | 619 | (void) GetNumberColors(image,file,&image->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 620 | } |
cristy | 4c96756 | 2011-06-16 01:46:57 +0000 | [diff] [blame] | 621 | else |
| 622 | if ((artifact != (const char *) NULL) && |
| 623 | (IsMagickTrue(artifact) != MagickFalse)) |
| 624 | (void) FormatLocaleFile(file," Colors: %.20g\n",(double) |
| 625 | GetNumberColors(image,(FILE *) NULL,&image->exception)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 626 | } |
| 627 | if (image->storage_class == PseudoClass) |
| 628 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 629 | (void) FormatLocaleFile(file," Colormap: %.20g\n",(double) image->colors); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 630 | if (image->colors <= 1024) |
| 631 | { |
| 632 | char |
| 633 | color[MaxTextExtent], |
| 634 | hex[MaxTextExtent], |
| 635 | tuple[MaxTextExtent]; |
| 636 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 637 | PixelInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 638 | pixel; |
| 639 | |
| 640 | register PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 641 | *restrict p; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 642 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 643 | GetPixelInfo(image,&pixel); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 644 | p=image->colormap; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 645 | for (i=0; i < (ssize_t) image->colors; i++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 646 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 647 | SetPixelInfoPacket(image,p,&pixel); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 648 | (void) CopyMagickString(tuple,"(",MaxTextExtent); |
cristy | fa806a7 | 2011-07-04 02:06:13 +0000 | [diff] [blame^] | 649 | ConcatenateColorComponent(&pixel,RedPixelComponent,X11Compliance, |
| 650 | tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 651 | (void) ConcatenateMagickString(tuple,",",MaxTextExtent); |
cristy | fa806a7 | 2011-07-04 02:06:13 +0000 | [diff] [blame^] | 652 | ConcatenateColorComponent(&pixel,GreenPixelComponent,X11Compliance, |
| 653 | tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 654 | (void) ConcatenateMagickString(tuple,",",MaxTextExtent); |
cristy | fa806a7 | 2011-07-04 02:06:13 +0000 | [diff] [blame^] | 655 | ConcatenateColorComponent(&pixel,BluePixelComponent,X11Compliance, |
| 656 | tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 657 | if (pixel.colorspace == CMYKColorspace) |
| 658 | { |
| 659 | (void) ConcatenateMagickString(tuple,",",MaxTextExtent); |
cristy | fa806a7 | 2011-07-04 02:06:13 +0000 | [diff] [blame^] | 660 | ConcatenateColorComponent(&pixel,BlackPixelComponent, |
| 661 | X11Compliance,tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 662 | } |
| 663 | if (pixel.matte != MagickFalse) |
| 664 | { |
| 665 | (void) ConcatenateMagickString(tuple,",",MaxTextExtent); |
cristy | fa806a7 | 2011-07-04 02:06:13 +0000 | [diff] [blame^] | 666 | ConcatenateColorComponent(&pixel,AlphaPixelComponent, |
| 667 | X11Compliance,tuple); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 668 | } |
| 669 | (void) ConcatenateMagickString(tuple,")",MaxTextExtent); |
| 670 | (void) QueryMagickColorname(image,&pixel,SVGCompliance,color, |
| 671 | &image->exception); |
| 672 | GetColorTuple(&pixel,MagickTrue,hex); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 673 | (void) FormatLocaleFile(file," %8ld: %s %s %s\n",(long) i,tuple, |
| 674 | hex,color); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 675 | p++; |
| 676 | } |
| 677 | } |
| 678 | } |
| 679 | if (image->error.mean_error_per_pixel != 0.0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 680 | (void) FormatLocaleFile(file," Mean error per pixel: %g\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 681 | image->error.mean_error_per_pixel); |
| 682 | if (image->error.normalized_mean_error != 0.0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 683 | (void) FormatLocaleFile(file," Normalized mean error: %g\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 684 | image->error.normalized_mean_error); |
| 685 | if (image->error.normalized_maximum_error != 0.0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 686 | (void) FormatLocaleFile(file," Normalized maximum error: %g\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 687 | image->error.normalized_maximum_error); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 688 | (void) FormatLocaleFile(file," Rendering intent: %s\n", |
| 689 | CommandOptionToMnemonic(MagickIntentOptions,(ssize_t) |
| 690 | image->rendering_intent)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 691 | if (image->gamma != 0.0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 692 | (void) FormatLocaleFile(file," Gamma: %g\n",image->gamma); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 693 | if ((image->chromaticity.red_primary.x != 0.0) || |
| 694 | (image->chromaticity.green_primary.x != 0.0) || |
| 695 | (image->chromaticity.blue_primary.x != 0.0) || |
| 696 | (image->chromaticity.white_point.x != 0.0)) |
| 697 | { |
| 698 | /* |
| 699 | Display image chromaticity. |
| 700 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 701 | (void) FormatLocaleFile(file," Chromaticity:\n"); |
| 702 | (void) FormatLocaleFile(file," red primary: (%g,%g)\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 703 | image->chromaticity.red_primary.x,image->chromaticity.red_primary.y); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 704 | (void) FormatLocaleFile(file," green primary: (%g,%g)\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 705 | image->chromaticity.green_primary.x, |
| 706 | image->chromaticity.green_primary.y); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 707 | (void) FormatLocaleFile(file," blue primary: (%g,%g)\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 708 | image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 709 | (void) FormatLocaleFile(file," white point: (%g,%g)\n", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 710 | image->chromaticity.white_point.x,image->chromaticity.white_point.y); |
| 711 | } |
| 712 | if ((image->extract_info.width*image->extract_info.height) != 0) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 713 | (void) FormatLocaleFile(file," Tile geometry: %.20gx%.20g%+.20g%+.20g\n", |
| 714 | (double) image->extract_info.width,(double) image->extract_info.height, |
| 715 | (double) image->extract_info.x,(double) image->extract_info.y); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 716 | (void) FormatLocaleFile(file," Interlace: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 717 | MagickInterlaceOptions,(ssize_t) image->interlace)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 718 | (void) QueryColorname(image,&image->background_color,SVGCompliance,color, |
| 719 | &image->exception); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 720 | (void) FormatLocaleFile(file," Background color: %s\n",color); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 721 | (void) QueryColorname(image,&image->border_color,SVGCompliance,color, |
| 722 | &image->exception); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 723 | (void) FormatLocaleFile(file," Border color: %s\n",color); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 724 | (void) QueryColorname(image,&image->matte_color,SVGCompliance,color, |
| 725 | &image->exception); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 726 | (void) FormatLocaleFile(file," Matte color: %s\n",color); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 727 | (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color, |
| 728 | &image->exception); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 729 | (void) FormatLocaleFile(file," Transparent color: %s\n",color); |
| 730 | (void) FormatLocaleFile(file," Compose: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 731 | MagickComposeOptions,(ssize_t) image->compose)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 732 | if ((image->page.width != 0) || (image->page.height != 0) || |
| 733 | (image->page.x != 0) || (image->page.y != 0)) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 734 | (void) FormatLocaleFile(file," Page geometry: %.20gx%.20g%+.20g%+.20g\n", |
| 735 | (double) image->page.width,(double) image->page.height,(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 736 | image->page.x,(double) image->page.y); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 737 | if ((image->page.x != 0) || (image->page.y != 0)) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 738 | (void) FormatLocaleFile(file," Origin geometry: %+.20g%+.20g\n",(double) |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 739 | image->page.x,(double) image->page.y); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 740 | (void) FormatLocaleFile(file," Dispose: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 741 | MagickDisposeOptions,(ssize_t) image->dispose)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 742 | if (image->delay != 0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 743 | (void) FormatLocaleFile(file," Delay: %.20gx%.20g\n",(double) image->delay, |
cristy | e8c25f9 | 2010-06-03 00:53:06 +0000 | [diff] [blame] | 744 | (double) image->ticks_per_second); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 745 | if (image->iterations != 1) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 746 | (void) FormatLocaleFile(file," Iterations: %.20g\n",(double) |
| 747 | image->iterations); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 748 | if ((image->next != (Image *) NULL) || (image->previous != (Image *) NULL)) |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 749 | (void) FormatLocaleFile(file," Scene: %.20g of %.20g\n",(double) |
| 750 | image->scene,(double) GetImageListLength(image)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 751 | else |
| 752 | if (image->scene != 0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 753 | (void) FormatLocaleFile(file," Scene: %.20g\n",(double) image->scene); |
| 754 | (void) FormatLocaleFile(file," Compression: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 755 | MagickCompressOptions,(ssize_t) image->compression)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 756 | if (image->quality != UndefinedCompressionQuality) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 757 | (void) FormatLocaleFile(file," Quality: %.20g\n",(double) image->quality); |
| 758 | (void) FormatLocaleFile(file," Orientation: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 759 | MagickOrientationOptions,(ssize_t) image->orientation)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 760 | if (image->montage != (char *) NULL) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 761 | (void) FormatLocaleFile(file," Montage: %s\n",image->montage); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 762 | if (image->directory != (char *) NULL) |
| 763 | { |
| 764 | Image |
| 765 | *tile; |
| 766 | |
| 767 | ImageInfo |
| 768 | *image_info; |
| 769 | |
| 770 | register char |
| 771 | *p, |
| 772 | *q; |
| 773 | |
| 774 | WarningHandler |
| 775 | handler; |
| 776 | |
| 777 | /* |
| 778 | Display visual image directory. |
| 779 | */ |
| 780 | image_info=AcquireImageInfo(); |
| 781 | (void) CloneString(&image_info->size,"64x64"); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 782 | (void) FormatLocaleFile(file," Directory:\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 783 | for (p=image->directory; *p != '\0'; p++) |
| 784 | { |
| 785 | q=p; |
| 786 | while ((*q != '\n') && (*q != '\0')) |
| 787 | q++; |
| 788 | (void) CopyMagickString(image_info->filename,p,(size_t) (q-p+1)); |
| 789 | p=q; |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 790 | (void) FormatLocaleFile(file," %s",image_info->filename); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 791 | handler=SetWarningHandler((WarningHandler) NULL); |
| 792 | tile=ReadImage(image_info,&image->exception); |
| 793 | (void) SetWarningHandler(handler); |
| 794 | if (tile == (Image *) NULL) |
| 795 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 796 | (void) FormatLocaleFile(file,"\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 797 | continue; |
| 798 | } |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 799 | (void) FormatLocaleFile(file," %.20gx%.20g %s\n",(double) |
| 800 | tile->magick_columns,(double) tile->magick_rows,tile->magick); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 801 | (void) SignatureImage(tile); |
| 802 | ResetImagePropertyIterator(tile); |
| 803 | property=GetNextImageProperty(tile); |
| 804 | while (property != (const char *) NULL) |
| 805 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 806 | (void) FormatLocaleFile(file," %s:\n",property); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 807 | value=GetImageProperty(tile,property); |
| 808 | if (value != (const char *) NULL) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 809 | (void) FormatLocaleFile(file,"%s\n",value); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 810 | property=GetNextImageProperty(tile); |
| 811 | } |
| 812 | tile=DestroyImage(tile); |
| 813 | } |
| 814 | image_info=DestroyImageInfo(image_info); |
| 815 | } |
| 816 | (void) GetImageProperty(image,"exif:*"); |
| 817 | ResetImagePropertyIterator(image); |
| 818 | property=GetNextImageProperty(image); |
| 819 | if (property != (const char *) NULL) |
| 820 | { |
| 821 | /* |
| 822 | Display image properties. |
| 823 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 824 | (void) FormatLocaleFile(file," Properties:\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 825 | while (property != (const char *) NULL) |
| 826 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 827 | (void) FormatLocaleFile(file," %s: ",property); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 828 | value=GetImageProperty(image,property); |
| 829 | if (value != (const char *) NULL) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 830 | (void) FormatLocaleFile(file,"%s\n",value); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 831 | property=GetNextImageProperty(image); |
| 832 | } |
| 833 | } |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 834 | (void) FormatLocaleString(key,MaxTextExtent,"8BIM:1999,2998:#1"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 835 | value=GetImageProperty(image,key); |
| 836 | if (value != (const char *) NULL) |
| 837 | { |
| 838 | /* |
| 839 | Display clipping path. |
| 840 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 841 | (void) FormatLocaleFile(file," Clipping path: "); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 842 | if (strlen(value) > 80) |
| 843 | (void) fputc('\n',file); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 844 | (void) FormatLocaleFile(file,"%s\n",value); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 845 | } |
| 846 | ResetImageProfileIterator(image); |
| 847 | name=GetNextImageProfile(image); |
| 848 | if (name != (char *) NULL) |
| 849 | { |
| 850 | const StringInfo |
| 851 | *profile; |
| 852 | |
| 853 | /* |
| 854 | Identify image profiles. |
| 855 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 856 | (void) FormatLocaleFile(file," Profiles:\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 857 | while (name != (char *) NULL) |
| 858 | { |
| 859 | profile=GetImageProfile(image,name); |
| 860 | if (profile == (StringInfo *) NULL) |
| 861 | continue; |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 862 | (void) FormatLocaleFile(file," Profile-%s: %.20g bytes\n",name, |
| 863 | (double) GetStringInfoLength(profile)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 864 | #if defined(MAGICKCORE_LCMS_DELEGATE) |
| 865 | if ((LocaleCompare(name,"icc") == 0) || |
| 866 | (LocaleCompare(name,"icm") == 0)) |
| 867 | { |
| 868 | cmsHPROFILE |
| 869 | icc_profile; |
| 870 | |
| 871 | icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile), |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 872 | (cmsUInt32Number) GetStringInfoLength(profile)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 873 | if (icc_profile != (cmsHPROFILE *) NULL) |
| 874 | { |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 875 | #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 876 | const char |
| 877 | *name; |
| 878 | |
| 879 | name=cmsTakeProductName(icc_profile); |
| 880 | if (name != (const char *) NULL) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 881 | (void) FormatLocaleFile(file," %s\n",name); |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 882 | #else |
| 883 | char |
| 884 | info[MaxTextExtent]; |
| 885 | |
| 886 | (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription, |
| 887 | "en","US",info,MaxTextExtent); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 888 | (void) FormatLocaleFile(file," Description: %s\n",info); |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 889 | (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer, |
| 890 | "en","US",info,MaxTextExtent); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 891 | (void) FormatLocaleFile(file," Manufacturer: %s\n",info); |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 892 | (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en", |
| 893 | "US",info,MaxTextExtent); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 894 | (void) FormatLocaleFile(file," Model: %s\n",info); |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 895 | (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright, |
| 896 | "en","US",info,MaxTextExtent); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 897 | (void) FormatLocaleFile(file," Copyright: %s\n",info); |
cristy | d09bcf9 | 2010-03-25 03:04:45 +0000 | [diff] [blame] | 898 | #endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 899 | (void) cmsCloseProfile(icc_profile); |
| 900 | } |
| 901 | } |
| 902 | #endif |
| 903 | if (LocaleCompare(name,"iptc") == 0) |
| 904 | { |
| 905 | char |
| 906 | *attribute, |
| 907 | **attribute_list; |
| 908 | |
| 909 | const char |
| 910 | *tag; |
| 911 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 912 | long |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 913 | dataset, |
| 914 | record, |
| 915 | sentinel; |
| 916 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 917 | register ssize_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 918 | j; |
| 919 | |
| 920 | size_t |
| 921 | length, |
| 922 | profile_length; |
| 923 | |
| 924 | profile_length=GetStringInfoLength(profile); |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 925 | for (i=0; i < (ssize_t) profile_length; i+=(ssize_t) length) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 926 | { |
| 927 | length=1; |
| 928 | sentinel=GetStringInfoDatum(profile)[i++]; |
| 929 | if (sentinel != 0x1c) |
| 930 | continue; |
| 931 | dataset=GetStringInfoDatum(profile)[i++]; |
| 932 | record=GetStringInfoDatum(profile)[i++]; |
| 933 | switch (record) |
| 934 | { |
| 935 | case 5: tag="Image Name"; break; |
| 936 | case 7: tag="Edit Status"; break; |
| 937 | case 10: tag="Priority"; break; |
| 938 | case 15: tag="Category"; break; |
| 939 | case 20: tag="Supplemental Category"; break; |
| 940 | case 22: tag="Fixture Identifier"; break; |
| 941 | case 25: tag="Keyword"; break; |
| 942 | case 30: tag="Release Date"; break; |
| 943 | case 35: tag="Release Time"; break; |
| 944 | case 40: tag="Special Instructions"; break; |
| 945 | case 45: tag="Reference Service"; break; |
| 946 | case 47: tag="Reference Date"; break; |
| 947 | case 50: tag="Reference Number"; break; |
| 948 | case 55: tag="Created Date"; break; |
| 949 | case 60: tag="Created Time"; break; |
| 950 | case 65: tag="Originating Program"; break; |
| 951 | case 70: tag="Program Version"; break; |
| 952 | case 75: tag="Object Cycle"; break; |
| 953 | case 80: tag="Byline"; break; |
| 954 | case 85: tag="Byline Title"; break; |
| 955 | case 90: tag="City"; break; |
| 956 | case 95: tag="Province State"; break; |
| 957 | case 100: tag="Country Code"; break; |
| 958 | case 101: tag="Country"; break; |
| 959 | case 103: tag="Original Transmission Reference"; break; |
| 960 | case 105: tag="Headline"; break; |
| 961 | case 110: tag="Credit"; break; |
| 962 | case 115: tag="Src"; break; |
| 963 | case 116: tag="Copyright String"; break; |
| 964 | case 120: tag="Caption"; break; |
| 965 | case 121: tag="Local Caption"; break; |
| 966 | case 122: tag="Caption Writer"; break; |
| 967 | case 200: tag="Custom Field 1"; break; |
| 968 | case 201: tag="Custom Field 2"; break; |
| 969 | case 202: tag="Custom Field 3"; break; |
| 970 | case 203: tag="Custom Field 4"; break; |
| 971 | case 204: tag="Custom Field 5"; break; |
| 972 | case 205: tag="Custom Field 6"; break; |
| 973 | case 206: tag="Custom Field 7"; break; |
| 974 | case 207: tag="Custom Field 8"; break; |
| 975 | case 208: tag="Custom Field 9"; break; |
| 976 | case 209: tag="Custom Field 10"; break; |
| 977 | case 210: tag="Custom Field 11"; break; |
| 978 | case 211: tag="Custom Field 12"; break; |
| 979 | case 212: tag="Custom Field 13"; break; |
| 980 | case 213: tag="Custom Field 14"; break; |
| 981 | case 214: tag="Custom Field 15"; break; |
| 982 | case 215: tag="Custom Field 16"; break; |
| 983 | case 216: tag="Custom Field 17"; break; |
| 984 | case 217: tag="Custom Field 18"; break; |
| 985 | case 218: tag="Custom Field 19"; break; |
| 986 | case 219: tag="Custom Field 20"; break; |
| 987 | default: tag="unknown"; break; |
| 988 | } |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 989 | (void) FormatLocaleFile(file," %s[%.20g,%.20g]: ",tag, |
| 990 | (double) dataset,(double) record); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 991 | length=(size_t) (GetStringInfoDatum(profile)[i++] << 8); |
| 992 | length|=GetStringInfoDatum(profile)[i++]; |
| 993 | attribute=(char *) NULL; |
cristy | 37e0b38 | 2011-06-07 13:31:21 +0000 | [diff] [blame] | 994 | if (~length >= (MaxTextExtent-1)) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 995 | attribute=(char *) AcquireQuantumMemory(length+ |
| 996 | MaxTextExtent,sizeof(*attribute)); |
| 997 | if (attribute != (char *) NULL) |
| 998 | { |
| 999 | (void) CopyMagickString(attribute,(char *) |
| 1000 | GetStringInfoDatum(profile)+i,length+1); |
| 1001 | attribute_list=StringToList(attribute); |
| 1002 | if (attribute_list != (char **) NULL) |
| 1003 | { |
| 1004 | for (j=0; attribute_list[j] != (char *) NULL; j++) |
| 1005 | { |
| 1006 | (void) fputs(attribute_list[j],file); |
| 1007 | (void) fputs("\n",file); |
| 1008 | attribute_list[j]=(char *) RelinquishMagickMemory( |
| 1009 | attribute_list[j]); |
| 1010 | } |
| 1011 | attribute_list=(char **) RelinquishMagickMemory( |
| 1012 | attribute_list); |
| 1013 | } |
| 1014 | attribute=DestroyString(attribute); |
| 1015 | } |
| 1016 | } |
| 1017 | } |
| 1018 | if (image->debug != MagickFalse) |
| 1019 | PrintStringInfo(file,name,profile); |
| 1020 | name=GetNextImageProfile(image); |
| 1021 | } |
| 1022 | } |
| 1023 | ResetImageArtifactIterator(image); |
| 1024 | artifact=GetNextImageArtifact(image); |
| 1025 | if (artifact != (const char *) NULL) |
| 1026 | { |
| 1027 | /* |
| 1028 | Display image artifacts. |
| 1029 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1030 | (void) FormatLocaleFile(file," Artifacts:\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1031 | while (artifact != (const char *) NULL) |
| 1032 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1033 | (void) FormatLocaleFile(file," %s: ",artifact); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1034 | value=GetImageArtifact(image,artifact); |
| 1035 | if (value != (const char *) NULL) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1036 | (void) FormatLocaleFile(file,"%s\n",value); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1037 | artifact=GetNextImageArtifact(image); |
| 1038 | } |
| 1039 | } |
| 1040 | ResetImageRegistryIterator(); |
| 1041 | registry=GetNextImageRegistry(); |
| 1042 | if (registry != (const char *) NULL) |
| 1043 | { |
| 1044 | /* |
| 1045 | Display image registry. |
| 1046 | */ |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1047 | (void) FormatLocaleFile(file," Registry:\n"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1048 | while (registry != (const char *) NULL) |
| 1049 | { |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1050 | (void) FormatLocaleFile(file," %s: ",registry); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1051 | value=(const char *) GetImageRegistry(StringRegistryType,registry, |
| 1052 | &image->exception); |
| 1053 | if (value != (const char *) NULL) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1054 | (void) FormatLocaleFile(file,"%s\n",value); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1055 | registry=GetNextImageRegistry(); |
| 1056 | } |
| 1057 | } |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1058 | (void) FormatLocaleFile(file," Tainted: %s\n",CommandOptionToMnemonic( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 1059 | MagickBooleanOptions,(ssize_t) image->taint)); |
cristy | b9080c9 | 2009-12-01 20:13:26 +0000 | [diff] [blame] | 1060 | (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1061 | (void) FormatLocaleFile(file," Filesize: %sB\n",format); |
cristy | b9080c9 | 2009-12-01 20:13:26 +0000 | [diff] [blame] | 1062 | (void) FormatMagickSize((MagickSizeType) image->columns*image->rows, |
| 1063 | MagickFalse,format); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1064 | (void) FormatLocaleFile(file," Number pixels: %s\n",format); |
cristy | 3d23169 | 2009-09-29 01:05:22 +0000 | [diff] [blame] | 1065 | (void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/ |
cristy | b9080c9 | 2009-12-01 20:13:26 +0000 | [diff] [blame] | 1066 | elapsed_time+0.5),MagickFalse,format); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1067 | (void) FormatLocaleFile(file," Pixels per second: %s\n",format); |
| 1068 | (void) FormatLocaleFile(file," User time: %0.3fu\n",user_time); |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 1069 | (void) FormatLocaleFile(file," Elapsed time: %lu:%02lu.%03lu\n", |
| 1070 | (unsigned long) (elapsed_time/60.0),(unsigned long) ceil(fmod( |
| 1071 | elapsed_time,60.0)),(unsigned long) (1000.0*(elapsed_time-floor( |
| 1072 | elapsed_time)))); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 1073 | (void) FormatLocaleFile(file," Version: %s\n",GetMagickVersion((size_t *) |
cristy | 3d23169 | 2009-09-29 01:05:22 +0000 | [diff] [blame] | 1074 | NULL)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1075 | (void) fflush(file); |
| 1076 | return(ferror(file) != 0 ? MagickFalse : MagickTrue); |
| 1077 | } |