MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / readDimensions

Method readDimensions

src/preview.cpp:431–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431bool LoaderNative::readDimensions() {
432 if (!valid())
433 return false;
434 if (width_ != 0 || height_ != 0)
435 return true;
436
437 const DataBuf data = getData();
438 if (data.empty())
439 return false;
440
441 try {
442 auto image = ImageFactory::open(data.c_data(), data.size());
443 if (!image)
444 return false;
445 image->readMetadata();
446
447 width_ = image->pixelWidth();
448 height_ = image->pixelHeight();
449 } catch (const Error& /* error */) {
450#ifndef SUPPRESS_WARNINGS
451 EXV_WARNING << "Invalid native preview image.\n";
452#endif
453 return false;
454 }
455 return true;
456}
457
458LoaderExifJpeg::LoaderExifJpeg(PreviewId id, const Image& image, int parIdx) : Loader(id, image) {
459 const ExifData& exifData = image_.exifData();

Callers 1

getPreviewPropertiesMethod · 0.45

Calls 10

ErrorFunction · 0.85
strErrorFunction · 0.85
c_dataMethod · 0.80
mmapMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
readMetadataMethod · 0.45
pixelWidthMethod · 0.45
pixelHeightMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected