¿Cómo saber rápidamente la resolución de una imagen?

7

Estoy buscando una manera agradable y rápida de mostrar la resolución de una imagen desde OS X 10.9. Actualmente, tengo que abrir la imagen en photoshop y luego ingresar a un menú para conocer la resolución. El proceso es demasiado lento cuando tengo que navegar a través de docenas de imágenes y obtenerlas con una resolución lo suficientemente grande.

    
pregunta Colas 11.02.2015 - 11:14

4 respuestas

6

Obtener información

Puedes obtener la resolución en el menú Obtener información . Seleccione la imagen y presione ⌘ CMD + i , o haga clic derecho en esa imagen y elija Obtener información .

Imagende cultofmac.com

complemento de QuickLook

Si no estabas en 10.9, este complemento ligero QuickLook llamado qlImageSize que se puede encontrar en GitHub le permite verificar el tamaño de la imagen en el título de la ventana de vista rápida. No tengo ninguno que funcione en 10.9, pero quizás esto lo ayude si desea buscar uno similar o informar sobre la compatibilidad con 10.9 a ese proyecto para mejorar.

    
respondido por el Mateusz Szlosek 11.02.2015 - 11:26
2

Desde la línea de comandos si tiene imagemagick instalado (por ejemplo, a través de homebrew o installer ), luego puede usar el siguiente comando para mostrar rápidamente la resolución e información similar de varias imágenes en un directorio:

$ ls
a.jpg
b.png
c.png
$ identify *
a.jpg JPEG 550x309 550x309+0+0 8-bit sRGB 29.4KB 0.000u 0:00.000
b.png[1] PNG 1912x827 1912x827+0+0 8-bit sRGB 2.17MB 0.000u 0:00.009
c.png[2] PNG 311x262 311x262+0+0 8-bit sRGB 185KB 0.000u 0:00.000

O si solo necesitas la resolución:

$ identify * | cut -d' ' -f1,3
a.jpg 550x309
b.png[1] 1912x827
c.png[2] 311x262

La especificación de -verbose te dará información aún más rápida que puedes grep en caso de que sea necesaria:

$ identify -verbose c.png
Image: c.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 311x262+0+0
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 154.515 (0.60594)
      standard deviation: 66.9006 (0.262355)
      kurtosis: -0.83131
      skewness: -0.468887
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 148.544 (0.582527)
      standard deviation: 77.5386 (0.304073)
      kurtosis: -1.18136
      skewness: -0.438364
    Blue:
      min: 27 (0.105882)
      max: 255 (1)
      mean: 176.548 (0.692343)
      standard deviation: 62.2995 (0.244312)
      kurtosis: -0.971188
      skewness: -0.584194
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 159.869 (0.626937)
      standard deviation: 69.2078 (0.271403)
      kurtosis: -0.754397
      skewness: -0.568073
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 311x262+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-02-11T15:20:41+00:00
    date:modify: 2015-01-28T10:04:15+00:00
    png:iCCP: chunk was found
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 2
    png:IHDR.color_type: 2 (Truecolor)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 311, 262
    signature: 35b3a0e9c50c785bece1ceff5a202823922cc78c2740cf9e0ff30d6143c89fdf
  Profiles:
    Profile-icc: 3276 bytes
  Artifacts:
    filename: c.png
    verbose: true
  Tainted: False
  Filesize: 185KB
  Number pixels: 81.5K
  Pixels per second: 2.716MB
  User time: 0.000u
  Elapsed time: 0:01.029
  Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-12 http://www.imagemagick.org
    
respondido por el SztupY 11.02.2015 - 15:50
2

La forma más rápida es tener los detalles de la resolución visibles todo el tiempo;)

Revisa el siguiente paso:

Seleccione"Mostrar opciones de vista" haciendo clic derecho en el escritorio

Marquelacasilla"Mostrar información del artículo"

* COLUMN VIEW

    
respondido por el JW_ 16.02.2015 - 22:05
0

Esta es una tarea trivial. He escrito un programa c ++ que puede mostrar en la terminal. Podría publicar si estás interesado. También sería trivial escribir un Service para mostrar el resultado.

//
//  Display  Comment, size of JPEG image
//

#include <iostream>
#include "../jpeg.h"

int main (int argc, const char * argv[])
{
    Cjpeg Jpeg1;

    switch(Jpeg1.OpenJpeg(argv[1]))
    {
        case INVALID_JPEG:
            std::cerr << "Invalid JPEG" << std::endl;
            return INVALID_JPEG;
        case NOTFOUND_JPEG:
            std::cerr << "File Not Found" << std::endl;
            return NOTFOUND_JPEG;
        case NOT_JPEG:
            std::cerr << "Not JPEG" << std::endl;
            return NOT_JPEG;
        default:
            std::cout << Jpeg1.Comments <<  " " <<  Jpeg1.Width <<  " * "  <<  Jpeg1.Height << std::endl;
    }
    return 0;
}

// jpeg.cpp: implementation of the Cjpeg class.
// ANSI version
//////////////////////////////////////////////////////////////////////

#include "jpeg.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Cjpeg::Cjpeg()
{
    Height = Width = 0;
    Comments[0] = '
//
//  Display  Comment, size of JPEG image
//

#include <iostream>
#include "../jpeg.h"

int main (int argc, const char * argv[])
{
    Cjpeg Jpeg1;

    switch(Jpeg1.OpenJpeg(argv[1]))
    {
        case INVALID_JPEG:
            std::cerr << "Invalid JPEG" << std::endl;
            return INVALID_JPEG;
        case NOTFOUND_JPEG:
            std::cerr << "File Not Found" << std::endl;
            return NOTFOUND_JPEG;
        case NOT_JPEG:
            std::cerr << "Not JPEG" << std::endl;
            return NOT_JPEG;
        default:
            std::cout << Jpeg1.Comments <<  " " <<  Jpeg1.Width <<  " * "  <<  Jpeg1.Height << std::endl;
    }
    return 0;
}

// jpeg.cpp: implementation of the Cjpeg class.
// ANSI version
//////////////////////////////////////////////////////////////////////

#include "jpeg.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Cjpeg::Cjpeg()
{
    Height = Width = 0;
    Comments[0] = '%pre%';
}

Cjpeg::~Cjpeg()
{

}

//--------------------------------------------------------------------------
// JPEG markers consist of one or more 0xFF bytes, followed by a marker
// code byte (which is not an FF).
//--------------------------------------------------------------------------

#define M_SOF0  0xC0            // Start Of Frame N
#define M_SOF1  0xC1            // N indicates which compression process
#define M_SOF2  0xC2            // Only SOF0-SOF2 are now in common use
#define M_SOF3  0xC3
#define M_SOF5  0xC5            // NB: codes C4 and CC are NOT SOF markers
#define M_SOF6  0xC6
#define M_SOF7  0xC7
#define M_SOF9  0xC9
#define M_SOF10 0xCA
#define M_SOF11 0xCB
#define M_SOF13 0xCD
#define M_SOF14 0xCE
#define M_SOF15 0xCF
#define M_SOI   0xD8            // Start Of Image (beginning of datastream)
#define M_EOI   0xD9            // End Of Image (end of datastream)
#define M_SOS   0xDA            // Start Of Scan (begins compressed data)
#define M_JFIF  0xE0            // Jfif marker
#define M_APP1  0xE1            // Exif marker
#define M_COM   0xFE            // COMment
#define M_DQT   0xDB
#define M_DHT   0xC4
#define M_DRI   0xDD

// Process a SOFn marker
void Cjpeg::process_SOF (unsigned length)
{
    int data_precision, num_components;
    unsigned char Data[128];
    unsigned long   cb; // count of bytes read

    cb = fread(&Data, 1, length, fp);   // read JPEG

    data_precision = Data[0];
    Height = Get16(Data+1);
    Width = Get16(Data+3);
    num_components = Data[5];
}

// Process a COM marker.
void Cjpeg::process_COM (unsigned length)
{
    unsigned nch;
    unsigned long   cb; // count of bytes read

    nch = 0;

    nch = (length > MAX_COMMENT) ? MAX_COMMENT : length;    // Truncate if it won't fit in our structure.
    cb = fread(&Comments, 1, nch, fp);  // read JPEG

    Comments[nch] = '%pre%'; // Null terminate
    if(cb<length)
    {
        fseek(fp, length - cb, SEEK_CUR);   // point to next JPEG marker
    }
}


void Cjpeg::process_APP1(unsigned int length)
{
    fseek(fp, length, SEEK_CUR);    // point to next JPEG marker
}


int Cjpeg::OpenJpeg(const char *JpegFile)
{
    int count;
    unsigned long   cb; // count of bytes read

    fp = fopen(JpegFile, "rb");
    if(fp == NULL)
    {
        return NOTFOUND_JPEG;
    }
    cb = fread(&JpegMarker, 2, 1, fp);  // read JPEG
    if(JpegMarker[0] != 0xFF || JpegMarker[1] != M_SOI)
    {
        fclose(fp);
        return NOT_JPEG;    // Not JPEG File
    }
    while(cb != 0) // Stop if EOF reached
    {
        cb = fread(&JpegMarker, 2, 1, fp);  // read JPEG marker
        if(JpegMarker[0] != 0xFF)
        {
            fclose(fp);
            return INVALID_JPEG;    // Invalid File
        }
        switch(JpegMarker[1])
        {
            case M_SOS: // stop before hitting compressed data
            case M_EOI: // in case it's a table only JPEG stream
                fclose(fp);
                return 0;   // Normal exit
        }
        cb = fread(&JpegSecCount, 2, 1, fp);    // read length of field
        count = Get16(JpegSecCount);
        count -= 2; // value includes length bytes
        switch(JpegMarker[1])
        {
            case M_COM: // Comment section
                process_COM (count);
                break;

            case M_SOF0:
            case M_SOF1:
            case M_SOF2:
                process_SOF (count);
                break;

            case M_APP1:
                process_APP1 (count);
                break;

            case M_JFIF:

            default:
                // Skip any other sections.
                fseek(fp, count, SEEK_CUR); // point to next JPEG marker
                break;
        }
    }
    fclose(fp);
    return INVALID_JPEG;    // Possible Invalid File
}
'; } Cjpeg::~Cjpeg() { } //-------------------------------------------------------------------------- // JPEG markers consist of one or more 0xFF bytes, followed by a marker // code byte (which is not an FF). //-------------------------------------------------------------------------- #define M_SOF0 0xC0 // Start Of Frame N #define M_SOF1 0xC1 // N indicates which compression process #define M_SOF2 0xC2 // Only SOF0-SOF2 are now in common use #define M_SOF3 0xC3 #define M_SOF5 0xC5 // NB: codes C4 and CC are NOT SOF markers #define M_SOF6 0xC6 #define M_SOF7 0xC7 #define M_SOF9 0xC9 #define M_SOF10 0xCA #define M_SOF11 0xCB #define M_SOF13 0xCD #define M_SOF14 0xCE #define M_SOF15 0xCF #define M_SOI 0xD8 // Start Of Image (beginning of datastream) #define M_EOI 0xD9 // End Of Image (end of datastream) #define M_SOS 0xDA // Start Of Scan (begins compressed data) #define M_JFIF 0xE0 // Jfif marker #define M_APP1 0xE1 // Exif marker #define M_COM 0xFE // COMment #define M_DQT 0xDB #define M_DHT 0xC4 #define M_DRI 0xDD // Process a SOFn marker void Cjpeg::process_SOF (unsigned length) { int data_precision, num_components; unsigned char Data[128]; unsigned long cb; // count of bytes read cb = fread(&Data, 1, length, fp); // read JPEG data_precision = Data[0]; Height = Get16(Data+1); Width = Get16(Data+3); num_components = Data[5]; } // Process a COM marker. void Cjpeg::process_COM (unsigned length) { unsigned nch; unsigned long cb; // count of bytes read nch = 0; nch = (length > MAX_COMMENT) ? MAX_COMMENT : length; // Truncate if it won't fit in our structure. cb = fread(&Comments, 1, nch, fp); // read JPEG Comments[nch] = '%pre%'; // Null terminate if(cb<length) { fseek(fp, length - cb, SEEK_CUR); // point to next JPEG marker } } void Cjpeg::process_APP1(unsigned int length) { fseek(fp, length, SEEK_CUR); // point to next JPEG marker } int Cjpeg::OpenJpeg(const char *JpegFile) { int count; unsigned long cb; // count of bytes read fp = fopen(JpegFile, "rb"); if(fp == NULL) { return NOTFOUND_JPEG; } cb = fread(&JpegMarker, 2, 1, fp); // read JPEG if(JpegMarker[0] != 0xFF || JpegMarker[1] != M_SOI) { fclose(fp); return NOT_JPEG; // Not JPEG File } while(cb != 0) // Stop if EOF reached { cb = fread(&JpegMarker, 2, 1, fp); // read JPEG marker if(JpegMarker[0] != 0xFF) { fclose(fp); return INVALID_JPEG; // Invalid File } switch(JpegMarker[1]) { case M_SOS: // stop before hitting compressed data case M_EOI: // in case it's a table only JPEG stream fclose(fp); return 0; // Normal exit } cb = fread(&JpegSecCount, 2, 1, fp); // read length of field count = Get16(JpegSecCount); count -= 2; // value includes length bytes switch(JpegMarker[1]) { case M_COM: // Comment section process_COM (count); break; case M_SOF0: case M_SOF1: case M_SOF2: process_SOF (count); break; case M_APP1: process_APP1 (count); break; case M_JFIF: default: // Skip any other sections. fseek(fp, count, SEEK_CUR); // point to next JPEG marker break; } } fclose(fp); return INVALID_JPEG; // Possible Invalid File }
    
respondido por el Milliways 11.02.2015 - 11:50

Lea otras preguntas en las etiquetas