6 Copyright (C) 2022 Balthasar SzczepaĆski
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Affero General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 Requires Dev Image Library (libdevil) (http://openil.sourceforge.net/)
23 on Pentium III libdevil must be recompiled with
24 --disable-ssl2 --disable-ssl3
25 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572954)
36 char INFO_MISSING_ARGS[] = "Missing parameters.\ninfo inPix\n";
38 void print_info_uint (char *name, long unsigned value)
40 fprintf(stdout, "%s: %lu\n", name, value);
42 void print_info_bool (char *name, long unsigned value)
44 fprintf(stdout, "%s: %s\n", name, value?"TRUE":"FALSE");
46 void print_info_datatype (char *name, long unsigned value)
48 fprintf(stdout,"%s: ",name);
52 fputs("BYTE", stdout);
55 fputs("DOUBLE", stdout);
58 fputs("FLOAT", stdout);
64 fputs("SHORT", stdout);
67 fputs("UNSIGNED INT", stdout);
69 case IL_UNSIGNED_BYTE:
70 fputs("UNSIGNED BYTE", stdout);
72 case IL_UNSIGNED_SHORT:
73 fputs("UNSIGNED SHORT", stdout);
76 fprintf(stdout, "? %ld", value);
82 void print_info_dataformat (char *name, long unsigned value)
84 fprintf(stdout,"%s: ",name);
91 fputs("BGRA", stdout);
94 fputs("COLOUR INDEX", stdout);
97 fputs("LUMINANCE", stdout);
99 case IL_LUMINANCE_ALPHA:
100 fputs("LUMINANCE ALPHA", stdout);
103 fputs("RGB", stdout);
106 fputs("RGBA", stdout);
109 fprintf(stdout, "? %ld", value);
115 void print_info_originmode (char *name, long unsigned value)
117 fprintf(stdout,"%s: ",name);
120 case IL_ORIGIN_LOWER_LEFT:
121 fputs("LOWER LEFT", stdout);
123 case IL_ORIGIN_UPPER_LEFT:
124 fputs("UPPER LEFT", stdout);
127 fprintf(stdout, "? %ld", value);
133 void print_info_palettetype (char *name, long unsigned value)
135 fprintf(stdout,"%s: ",name);
139 fputs("BGR24", stdout);
142 fputs("BGR32", stdout);
145 fputs("BGRA32", stdout);
148 fputs("RGB24", stdout);
151 fputs("RGB32", stdout);
154 fputs("RGBA32", stdout);
157 fprintf(stdout, "? %ld", value);
163 int subtool_info (int argc, char **argv, int argi, char **err)
169 struct IL_full_info info;
170 FLAG_TYPE flags = OK_PALETTE_ONLY | CAN_BE_MULTIPLE | CAN_BE_OVER_8BIT;
174 *err = INFO_MISSING_ARGS;
178 r = reserve_pictures(1);
181 *err = CREATE_FAILED;
185 for (i=argi; i<argc; ++i)
187 fprintf(stdout,"\n>>> %s <<<\n",argv[i]);
188 r = load_picture(0, argv[i], &info, &flags);
191 fputs("FAIL\n",stdout);
195 for (j=0; j<frames; ++j)
197 get_info(0, &info, j);
199 frames = info.num_images+1;
201 fprintf(stdout, "--- %lu ---\n", (unsigned long)j);
202 print_info_uint ("active_image", info.active_image);
203 print_info_uint ("active_layer", info.active_layer);
204 print_info_uint ("active_mipmap", info.active_mipmap);
205 print_info_bool ("blit_blend", info.blit_blend);
206 print_info_uint ("compress_mode", info.compress_mode);
207 print_info_bool ("conv_pal", info.conv_pal);
208 print_info_uint ("cur_image", info.cur_image);
209 print_info_bool ("default_on_fail", info.default_on_fail);
210 print_info_uint /*?*/ ("dxtc_data_format", info.dxtc_data_format);
211 print_info_bool ("file_mode", info.file_mode);
212 print_info_dataformat ("format_mode", info.format_mode);
213 print_info_bool ("format_set", info.format_set);
214 print_info_uint ("image_bits_per_pixel", info.image_bits_per_pixel);
215 print_info_uint ("image_bpc", info.image_bpc);
216 print_info_uint ("image_bytes_per_pixel", info.image_bytes_per_pixel);
217 print_info_uint ("image_channels", info.image_channels);
218 print_info_uint ("image_cubeflags", info.image_cubeflags);
219 print_info_uint ("image_depth", info.image_depth);
220 print_info_uint ("image_duration", info.image_duration);
221 print_info_dataformat ("image_format", info.image_format);
222 print_info_uint ("image_height", info.image_height);
223 print_info_uint ("image_offx", info.image_offx);
224 print_info_uint ("image_offy", info.image_offy);
225 print_info_originmode ("image_origin", info.image_origin);
226 print_info_uint ("image_planesize", info.image_planesize);
227 print_info_uint ("image_size_of_data", info.image_size_of_data);
228 print_info_datatype ("image_type", info.image_type);
229 print_info_uint ("image_width", info.image_width);
230 print_info_uint /*?*/ ("keep_dxtc_data", info.keep_dxtc_data);
231 print_info_uint ("num_faces", info.num_faces);
232 print_info_uint ("num_images", info.num_images);
233 print_info_uint ("num_layers", info.num_layers);
234 print_info_uint ("num_mipmaps", info.num_mipmaps);
235 print_info_originmode ("origin_mode", info.origin_mode);
236 print_info_bool ("origin_set", info.origin_set);
237 print_info_dataformat ("palette_base_type", info.palette_base_type);
238 print_info_uint ("palette_bpp", info.palette_bpp);
239 print_info_uint ("palette_num_cols", info.palette_num_cols);
240 print_info_palettetype("palette_type", info.palette_type);
241 print_info_datatype ("type_mode", info.type_mode);
242 print_info_bool ("type_set", info.type_set);
243 print_info_bool ("use_key_colour", info.use_key_colour);
244 print_info_uint ("version_num", info.palette_num_cols);