Comments (7)
@Molkars yeah I just did it manually, then convert it via app.
// Is BMP, convert.
if (listEquals([0x42, 0x4d], [newBytes[0], newBytes[1]])) {
mime = "image/bmp";
// Get bytes for this. Convert to jpeg.
final image = image_lib.decodeImage(newBytes)!;
bytes = Uint8List.fromList(image_lib.encodePng(image));
path = null;
}
}
from mime_type.
It's a bitmap image mislabeled as a jpg.
from mime_type.
@Molkars might be some Github thing that's compressed and converted it. Here is a direct link https://www.dropbox.com/t/o3QdorvooW4kcSzj
I even looked at the first 2 bits locally and it says it's BMP.
from mime_type.
It's weird that it is uploaded on dropbox as a .jpg as well.
from mime_type.
I think the file command probably checks the first few bytes of the file and gets the type based on that whereas this package just uses the extension. If you want it to check the header bytes, try the dart team's mime package.
from mime_type.
@Molkars thanks for the support. There's a native one or I have to download it? Can't seem to find it :-D
from mime_type.
@OllyDixon
https://pub.dev/packages/mime. You do have to do a little bit of work to read the first few header bytes but it will give you the correct file type nearly everytime.
from mime_type.
Related Issues (9)
- Missing mime type for json HOT 2
- Support null safety HOT 5
- MimeType getting null for audio files HOT 4
- Incorrect mime type HOT 2
- Wrong Extension from MimeType HOT 1
- If the order of the Map is made for most used extensions then it would be a lot better for getting extensions HOT 1
- There should be a method to match the type HOT 3
- Cannot import library HOT 2
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 mime_type.