Skip to content

TFPReaderBMP does not implement class function InternalSize --> Image size is returned to be -1

Summary

The fcl-image readers can determine the size of an image from the file header or meta data without having to load the entire image, function ImageSize() . For this purpose the base class, TFPCustomImageReader, provides a virtual class function InternalSize(), which every reader class must implement in order to support this feature.

The reader for BMP images, TFPReaderBMP, however, does not implement this method, and therefore, the image width and height are always reported by the ImageSize() function to be -1.

The attached patch provides the missing InternalSize() class method.

fpreadbmp_internalsize.diff

System Information

  • Operating system: Windows 11
  • Processor architecture: x86-64
  • Compiler version: trunk (22de0744)
  • Device: Computer

Steps to reproduce

The attached project uses the ImageSize() function to determine the size of the fp32.bmp image. The current code returns width and height to be -1. After application of above patch, the output is correct (Width = 32, Height = 32).

bmp_imagesize.zip

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information