Error on trying to open a tif image file
-
wrote on 2 Jun 2024, 04:07 last edited by
I am developing a software that performs some image processing operations on tiff images.
I wrote a simple class that uses QImageReader to load the tiff files#ifndef IMAGECROPPER_H #define IMAGECROPPER_H #include <QImage> #include <QRect> #include <QList> class ImageCropper { public: struct CropArea { QRect rect; QPoint displayPos; }; static QImage loadImage(const QString& filename); QList<QImage> cropImage(const QImage& image, const QList<CropArea> cropAreas); }; #endif
And the cpp file
#include "ImageCropper.h" #include <QImageReader> QImage ImageCropper::loadImage(const QString &filename) { return QImageReader(filename).read(); } QList<QImage> ImageCropper::cropImage(const QImage &image, const QList<CropArea> cropAreas) { QList<QImage> croppedImages; for (const CropArea &area : cropAreas) { QImage croppedImage = image.copy(area.rect); croppedImages.append(croppedImage); } return croppedImages; }
Unfortunately when I try to load the image file I get this errors:
TIFFReadDirectory: Warning, Unknown field with tag 347 (0x15b) encountered.
foo: JPEG compression support is not configured.
TIFFReadDirectory: Warning, Unknown field with tag 347 (0x15b) encountered.
foo: JPEG compression support is not configured.
foo: Sorry, requested compression method is not configured.
Failed to load or crop image.Is there a way to solve it?
-
I am developing a software that performs some image processing operations on tiff images.
I wrote a simple class that uses QImageReader to load the tiff files#ifndef IMAGECROPPER_H #define IMAGECROPPER_H #include <QImage> #include <QRect> #include <QList> class ImageCropper { public: struct CropArea { QRect rect; QPoint displayPos; }; static QImage loadImage(const QString& filename); QList<QImage> cropImage(const QImage& image, const QList<CropArea> cropAreas); }; #endif
And the cpp file
#include "ImageCropper.h" #include <QImageReader> QImage ImageCropper::loadImage(const QString &filename) { return QImageReader(filename).read(); } QList<QImage> ImageCropper::cropImage(const QImage &image, const QList<CropArea> cropAreas) { QList<QImage> croppedImages; for (const CropArea &area : cropAreas) { QImage croppedImage = image.copy(area.rect); croppedImages.append(croppedImage); } return croppedImages; }
Unfortunately when I try to load the image file I get this errors:
TIFFReadDirectory: Warning, Unknown field with tag 347 (0x15b) encountered.
foo: JPEG compression support is not configured.
TIFFReadDirectory: Warning, Unknown field with tag 347 (0x15b) encountered.
foo: JPEG compression support is not configured.
foo: Sorry, requested compression method is not configured.
Failed to load or crop image.Is there a way to solve it?
@franco-amato said in Error on trying to open a tif image file:
Is there a way to solve it?
Use libtiff directly with enabled jpeg support or provide a patch to Qt which enables it. Maybe it's worth creating a bug report.
1/2