Comments (13)
http://lazka.github.io/pgi-docs/GdkPixbuf-2.0/classes/Pixbuf.html#GdkPixbuf.Pixbuf.get_file_info
Parses an image file far enough to determine its format and size.
i believe this can be used instead of imghdr
from pim.
First of all thanks for your great work on Pim, I have highly enjoyed working with the codebase.
I did a quick debug on this. Looks like not all .bmp mimetypes are included in GdkPixbuf.Pixbuf.get_formats(). In my specific case, I tested with a few bitmaps exported from gimp, the "image/x-ms-bmp" type was missing. Simply appending that type to the supported ones solved the issue.
The problem is, I have no idea how many more types are missing and how one could find out what they are.
from pim.
Such kind words :D Although James Campos (aeosynth) should be praised mostly. As I just worked on his ToDo entries later.
And it was nice to see, someone taking this as base and enhancing it with various features.
And thanks for debugging this. Currently I don't have the time to check on this.
And if it's related to GdkPixbuf dunno what's the best thing to do.
Maybe some kind of regex, if the first check returned as unsupported, check if there are similar ones --> will be added and failure will be sorted out later as it could be covered by the routine with broken images.
Whatever hell pit such a handling will open :D Just some quick thought on this
from pim.
can you share some failing bitmaps? would checking extension (.bmp) instead of mime type fix this?
from pim.
https://paste.archlinux.de/m-gObM/
Well. Checking the extension would open the problem with non image files with an .bmp ending (for whatever reason those could exist)
Edit: Or without any extension
from pim.
those have the type image/x-ms-bmp
; GdkPixbuf supports image/x-MS-bmp
. a quick fix would be to lowercase the types (x-MS-bmp
is the only type using caps). using extensions is easier tho; users can rename their files if they have issues
from pim.
Just for sharing information: I had someone open an issue for opening images without any extension
karlch/vimiv#17
In general I agree with him, just filtering images by mimetype is not very sophisticated. Using the imghdr module might be a better alternative. I plan on testing that sometime this or next month, still pretty busy at the moment.
If it works and you are interested, I could probably implement a PR for Pim afterwards as well.
from pim.
you'd have to convince me by showing images which are only recognizable with that module
from pim.
Got to it earlier than expected.
Say you have a correct imagefile called "myimage" and a textfile called "text.png". The extension version wouldn't work whereas imghdr filters correctly.
As the opened issue shows the first case happens, the second one is rather esoteric but nice to be protected against. Sure, one could rename the files manually, but this shouldn't be necessary.
I have yet to find a file that imghdr does not handle correctly.
from pim.
The extension version wouldn't work whereas imghdr filters correctly.
what about the mimetype version?
i'd like to see real images which are detected differently
from pim.
Just rename any images of your choice accordingly 😃
I don't have a favourite pastebin yet...
from pim.
oh, i thought mimetypes
actually read from disk
from pim.
Nice catch! First tests with it seem to go perfectly well.
from pim.
Related Issues (20)
- react to screen rotation HOT 4
- keybind to change slideshow timer HOT 5
- notify when slideshow reaches end HOT 1
- better zoom lock HOT 5
- double click fullscreen HOT 1
- disable slideshow on seek
- filter by dimensions
- config file HOT 4
- overlay scrollbars HOT 5
- mouse panning HOT 8
- Latest deprecations HOT 3
- Image file with corrupted data
- Removal of an invalidated path shouldn't trigger physical deletion
- Image formats not covered by gobject
- upgrade to gtk4 HOT 3
- zoom to <0%
- looping if removal jumps to a defective picture HOT 1
- Keys HOT 1
- rotation lock HOT 6
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 pim.