Comments (12)
Can you share also tiff file?
from leptonica.
You can use any of these tiff files, they all have the same problem --> https://github.com/Sicos1977/TesseractOCR/tree/master/TesseractOCR.Tests/Data/Conversion
from leptonica.
C code works for me without a problem:
#include <leptonica/allheaders.h>
int main(int argc, char **argv) {
char *filein;
PIX *pixs;
l_ok ret;
l_int32 LeptMsgSeverity = 1;
if (argc != 2)
return fprintf(stderr," Syntax: %s filein", argv[0]);
filein = argv[1];
if ((pixs = pixRead(filein)) == NULL) {
ERROR_INT("pix not made", __func__, 1);
} else {
fprintf(stderr, "Leptonica loaded: %s\n", filein);
}
ret = pixWrite("pixs.png", pixs, IFF_PNG);
if (ret > 0)
ERROR_INT("ret of pixWrite: ", __func__, ret);
pixDestroy(&pixs);
return ret;
}
compiled with (MSVC 2019, Windows 10 64bit; libtiff 4.4.0):
cl test_tiff.c -I..\include ..\lib\leptonica-1.83.0.lib
e.g. test_tiff.exe photo_palette_4bpp.tif
creates the correct png output...
Seems like a problem with wrapping leptonica in C# .NET...
from leptonica.
Weird because 1.82 works without any problems. Is there a way to see if the tif library is compiled into the output file?
from leptonica.
Well, you should see an error message (in the console/terminal) if you try to open unsupported image format.
Also, check the output of leptonica function getImagelibVersions
.
You can also try to open an image with a format that does not need external lib (pbn, ppn, bmp) and save it as tiff...
from leptonica.
Images are saved in tiff
format correctly.
Versions of built-in libraries in leptonica-1.83.0
:
- libgif 5.2.1
- libjpeg 6b (libjpeg-turbo 2.0.6)
- libpng 1.6.37
- libtiff 4.3.0
- zlib 1.2.11
I think this is due to the fact that the image format (e. g. photo_rgb_32bpp.tif file) is not tiff
but bitmap
:
Looking at the commit d4ab740f6c0d40fe12ddc15c9ceba1f614711665 Leptonica does not support 32 bpp images.
from leptonica.
I checked one of the files with a hex editor and that seems like a tiff to me... as far as I know the first few bytes of a tiff image are always II
49 49 2A 00 (little-endian) | II*␀ | 0 | tiftiff | Tagged Image File Format (TIFF)[10] |
---|
from leptonica.
Yes, this is true for all files except what I wrote above (photo_rgb_32bpp.tif)
from leptonica.
When I run >test_tiff.exe photo_rgb_32bpp.tif
I see this message:
Error in pixReadMemBmp: 32 bpp rgba input data is not supported
Error in pixReadStream: bmp: no pix returned
Error in pixRead: pix not read
Error in main: pix not made
Error in pixWrite: pix not defined
from leptonica.
The only thing I find weird is that all files seem to work when using version 1.82. I have to dive deeper into this to see if I did something wrong but that will be next week because I'm busy with another project at the moment.
from leptonica.
- As already mentioned by vsolominov photo_rgb_32bpp.tif is BMP file with wrong extensions. The same message you can get with IrfanView
- leptonica 1.82 reads it - but when you run my tests code, the output in PNG does not have correct colors
- leptonica 1.83 refuse to load it - reason is explain in this commit d4ab740
from leptonica.
- As already mentioned by vsolominov photo_rgb_32bpp.tif is BMP file with wrong extensions. The same message you can get with IrfanView
- leptonica 1.82 reads it - but when you run my tests code, the output in PNG does not have correct colors
- leptonica 1.83 refuse to load it - reason is explain in this commit d4ab740
Okay, thinks missed that one.
from leptonica.
Related Issues (20)
- Suggest noting that libtiff must have been compiled with JPEG compression support for tests to run correctly HOT 4
- Leptonica 1.84 release schedule HOT 28
- How to detect the four corners of paper or ID card HOT 8
- 1.84.0 fails to build in FreeBSD 14.0 due missing reference to libm using CMake HOT 24
- CMake build in 1.84.0 adds include to non-existant path
- 1.84.1: compile time warnings HOT 3
- pixWriteJp2k: unexpected strong color artifacts on featureless image HOT 7
- pixOrientDetect with .bmp file HOT 6
- Logic error in pixcmapIsValid() HOT 5
- Regression: file not found on MacOS when opening /tmp file HOT 2
- Identifying and removing asterisks HOT 8
- pixDeskewGeneral(...) failing to detect a 45 degree skew? HOT 2
- Application crashing while disposing Pix.Create object HOT 5
- get minarea-rotated box of a skew area HOT 2
- pixRead() can't read png images HOT 5
- Crash when access Pix colormap on debug HOT 6
- Installing leptonica on Windows failed with reason prompt 'SW' not found HOT 2
- Errors building Leptonica for use with Tesseract HOT 2
- getImpliedFileFormat / pixWriteImpliedFormat and PNM issues HOT 2
- pixOrientCorrect/pixOrientDetect issue with PBM HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leptonica.