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