Git Product home page Git Product logo

Comments (7)

ollyde avatar ollyde commented on September 25, 2024 1

@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.

Molkars avatar Molkars commented on September 25, 2024

It's a bitmap image mislabeled as a jpg.

from mime_type.

ollyde avatar ollyde commented on September 25, 2024

@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.

Molkars avatar Molkars commented on September 25, 2024

It's weird that it is uploaded on dropbox as a .jpg as well.

from mime_type.

Molkars avatar Molkars commented on September 25, 2024

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.

ollyde avatar ollyde commented on September 25, 2024

@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.

Molkars avatar Molkars commented on September 25, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.