# IPCV does not read my TIFF image

**URL:** <https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846>\
**Category:** Signal and image processing\
**Created:** [February 28, 2025, 9:22pm UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846 "2025-02-28T21:22:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [February 28, 2025, 9:22pm UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/1 "2025-02-28T21:22:18Z")

</div>

Dear,

coming from here:

> [@Read BMP file without image processing toolboxes](https://scilab.discourse.group/t/read-bmp-file-without-image-processing-toolboxes/839/11):
>
> Can you post a TIFF file that IPCV does not read (what is the specificity of your tiff files) ? S.

Some comments to `IPCV` and TIFF.

I remember a discussion about it, which dates back to 2020.

> **[\[Scilab-users\] scilab and tif-files](https://lists.scilab.org/pipermail/users/2020-July/016358.html)**

Also, please note that `IPCV` has a dedicated function `tifread()`.

However this function is dedicated to a very specific tif format.

Probably `scicv` handles the TIFF format in a more general way.

Best regards,  
Philipp

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [March 1, 2025, 11:00am UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/2 "2025-03-01T11:00:17Z")

</div>

IPCV and IPCV are based on the same library OpenCV, and there is everything in OpenCV to open various types of TIFF files. However imread (in IPCV and scicv) at the Scilab level has a poor API as it does not have the same versatile options as OpenCV’s Imread.  
But may I insist : can you post here a TIFF file that IPCV does not read ? I have tested latest version with some example TIFF files and IPCV has read them without any problem.

S.

---

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [March 1, 2025, 5:29pm UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/3 "2025-03-01T17:29:34Z")

</div>

TIFF files can not be uploaded here.

 ![grafik](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/b12bfa6b11f94f6aa802dab7522296df5b202f48.png)

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [March 3, 2025, 7:49am UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/4 "2025-03-03T07:49:51Z")

</div>

Hi Philipp,

In imread() a piece of code testing if the image is bitmap is too aggressive. Can you replace the last lines in imread.sci by

```auto
    if (size(S,3) == 1 && sum(S==0)+sum(S==255)) == prod(size(S)) 
        S = im2bw(S,0.5);
    end

```

then execute imread.sci to redefine the function ? Your example tiff image should display as you want:

 ![Capture d’écran 2025-03-03 à 08.48.15](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/8145b5959ad36aecdfc203dc3197163e04989b86.png)  
Next version will include this fix.

S.

---

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [March 3, 2025, 10:41am UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/5 "2025-03-03T10:41:58Z")

</div>

Hi Stéphane,

Well, thank you., that worked.

Do I understand correctly:

The TIFF is actually used as a container to hold a RGB bitmap ?

see: [https://paulbourke.net/dataformats/tiff/tiff.pdf](https://paulbourke.net/dataformats/tiff/tiff.pdf) , page 24.

To not mess around with the existing imread() function:

Would it be possible to define a new IPCV function imread\_TiffRGB() or something of that kind?

Not ideal, but maybe a solution to extend IPCV capabilities?

Probably also more a question to Chin Luh Tan .

Best Regards,  
Philipp

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [March 3, 2025, 10:56am UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/6 "2025-03-03T10:56:45Z")

</div>

I don’t see why there could be any mess around with imread(). The actual imread() code was faultly and the proposed patch allows to read RGB TIFF without interfering with other formats. There is no need for a new dedicated function (you can ask Chin Luh Tan if you want, but I mainly maintain IPCV now so he will probably agree for any fix that improves user experience).

S.

---

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [March 3, 2025, 11:27am UTC](https://scilab.discourse.group/t/ipcv-does-not-read-my-tiff-image/846/7 "2025-03-03T11:27:20Z")

</div>

Ah, ok. Understood. I thought the change might influence other formats…e.g imread would become tailored to this specific tiff format.
