Seguimi in Twitter Seguimi in Facebook Seguimi in Pinterest Seguimi in LinkedIn Seguimi in Google+ Seguimi  in Stumbleupon seguimi  in instagram Sottoscrivi il feed
Blender, graphic, software, open source, Linux LibreOffice, open source, openoffice Gimp, graphic, software, open source, Linux kernel, Linux, software, open source Linux, distributions, Ubuntu, Linux Mint, Fedora, Mandriva Jamin, gpl, library, open source matroska, multimedia, container, linux pcman, file manager, linux LuninuX, distribition, Linux, open source Linux, infographic, history
Home » , » Jpeginfo is a command line tool used to generate informative listings of JPEG files, and also to check JPEG files for errors

Jpeginfo is a command line tool used to generate informative listings of JPEG files, and also to check JPEG files for errors

Jpeginfo_1Jpeginfo is a small tool that shows information about jpegs. Given a list of jpeg file arguments, it shows the image sizes, the number of components in each image, and the color scheme.

It's a really small tool of which I'm sure that countless other exist. I was too lazy to search for something suitable, so I just cooked it myself. As an example, given a command line like jpeginfo *.jpg it might show:

xroads2.jpg: 1203 x 800 / 3 components / Y/Cb/Cr
xroads4.jpg: 1203 x 800 / 3 components / Y/Cb/Cr

To get it yourself, copy the two listings below as jpeginfo.c and as Makefile. Then hit make install. You will need libjpeg on your system, including the header file jpeglib.h. This is often called package libjpeg-devel or similar (so you'll need not just the runtime package, but the development files as well).

The step make install puts the binary program jpeginfo into /usr/local/bin. Edit the Makefile if you want a different location.

The Files.

Here is jpeginfo.c:

 * jpeginfo.c
 * Part of jpeginfo, a small tool to show properties of jpeg images.
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jpeglib.h>

int main (int argc, char **argv) {
    struct jpeg_decompress_struct cinfo;
    struct jpeg_error_mgr jerr;
    int i;
    FILE *inf;
    /* Verify argument list */
    if (argc < 2) {
 fprintf (stderr,
"This is jpeginfo V" VER ", copyright (c) Karel Kubat <karel@kubat.nl>.\n" 
"Visit http://www.kubat.nl/pages/jpeginfo for downloads and information.\n"
"Usage: jpeginfo jpegfile(s)\n"
"Shows properties of the stated file(s). Use '-' for stdin.\n"
 exit (1


    /* Process all files. */
    for (i = 1; i < argc; i++) {
 cinfo.err = jpeg_std_error (&jerr);
 jpeg_create_decompress (&cinfo);

 printf ("%s: ", argv[i]);
        fflush (stdout);
 if (!strcmp (argv[i], "-"))
     jpeg_stdio_src (&cinfo, stdin);
 else if (! (inf = fopen (argv[i], "r")) ) {
     fprintf (stderr, "Cannot read %s: %s\n", argv[i], strerror(errno));
     exit (1);
 } else
     jpeg_stdio_src (&cinfo, inf);

 jpeg_read_header (&cinfo, TRUE);

 printf ("%u x %u / %d components / ",
  cinfo.image_width, cinfo.image_height,
 switch (cinfo.jpeg_color_space) {
     printf ("monochrome");
 case JCS_RGB:
     printf ("red/green/blue");
 case JCS_YCbCr:
     printf ("Y/Cb/Cr");
 case JCS_CMYK:
     printf ("C/M/Y/K");
 case JCS_YCCK:
     printf ("Y/Cb/Cr/K");
     printf ("unknown");
 putchar ('\n');
 jpeg_destroy_decompress (&cinfo);
 if (strcmp (argv[i], "-"))
     fclose (inf);

    /* All done */
    return (0);

And here is the Makefile:

# Central Makefile for jpeginfo
# -----------------------------

BINDIR = /usr/local/bin
VER = 1.00

jpeginfo: jpeginfo.o
 $(CC) -o $@ -L/opt/local/lib -ljpeg $<

jpeginfo.o: jpeginfo.c Makefile
 $(CC) -c -g -Wall -W -o $@ -DVER=\"$(VER)\" $<

 rm -f jpeginfo jpeginfo.o .gdb_history

install: jpeginfo
 mkdir -p $(BINDIR)
 install -s jpeginfo $(BINDIR)/jpeginfo

Custom Search
If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

0 commenti:

Post a Comment

Random Posts

My Blog List

Recent Posts

Recent Posts Widget

Popular Posts




Images Photo Gallery

page counter Mi Ping en TotalPing.com
Copyright © 2014 Linuxlandit & The Conqueror Penguin