Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error on trying to open a tif image file
Forum Updated to NodeBB v4.3 + New Features

Error on trying to open a tif image file

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 188 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    franco.amato
    wrote on 2 Jun 2024, 04:07 last edited by
    #1

    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?

    C 1 Reply Last reply 2 Jun 2024, 06:41
    0
    • F franco.amato
      2 Jun 2024, 04:07

      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?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 2 Jun 2024, 06:41 last edited by
      #2

      @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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      1/2

      2 Jun 2024, 04:07

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved