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