Git Product home page Git Product logo

Comments (8)

etemesi254 avatar etemesi254 commented on September 26, 2024 4

Hi, hope I didn't keep you waiting for long, made a 0.5.0-rc0 release that should contain a fix for this.

The library can now read from anything that implements Bufread + Seek as long as the std feature is enabled. This is usually enabled by default so the only thing that changes is bumping up the dependency and fixing some breaking changes

from image.

etemesi254 avatar etemesi254 commented on September 26, 2024 2

The dev branch contains the changes already, still doing some benchmarks and fuzz testing to see the impact of the changes, then a 0.5 rc release is planned, (but want to see if i can get some perf changes before then hence why I've been delaying)

from image.

fintelia avatar fintelia commented on September 26, 2024 1

Created #2198 to try out the new release

from image.

nashaofu avatar nashaofu commented on September 26, 2024

Save as JPEG does not meet the expectations. The following is a duplication code.

use image;

fn main() {
    let im = image::open("input.png").unwrap();
    im.save("output.jpeg").unwrap();
}
  • input.png
    input
  • output.jpeg
    output

from image.

fintelia avatar fintelia commented on September 26, 2024

@nashaofu This is an issue thread for a specific concern about memory use in the JPEG decoder, while the issue you're reporting looks like it might be caused by #2173. Please feel free to create a new issue if the fix suggested in that thread doesn't work

from image.

fintelia avatar fintelia commented on September 26, 2024

@djc This is currently necessary due to an API mismatch between image and zune-jpeg (the crate we use for JPEG decoding). In the image crate, our fancier decoders take a BufRead + Seek implementation, but zune-jpeg requires a ZReaderTrait impl that can essentially only be a &[u8], Vec<u8> or similar (specifically notice that the required methods take shared references so the type cannot have interior mutability).

Tagging @etemesi254 because I believe they are currently working on changing how zune-image handles stream reading

from image.

etemesi254 avatar etemesi254 commented on September 26, 2024

Hi, I changed it to allow it to take anything that implements a different trait, we do have stream decoding now, but because of Rust's lack of specialization, I can't blanket it to allow a it to decode BufRead+Seek.

It's currently specialized on some common types such as Buffered files, std io cursor and in memory buffers, wrapped with (a ZCursor which is a std::io::Cursor reimpl that works in no-std environments).

This is a breaking change tho, but it makes it easy to add a separate impl that allows Bufread + Seek maybe something like

struct ZBufReadSeeker<T:BufRead + Seek>{
  source: T
}

impl<T:BufRead + Seek> ZByteReaderTrait for  ZBufReadSeeker<T>{
    
}

from image.

djc avatar djc commented on September 26, 2024

@etemesi254 great to hear this is being addressed -- I think your solution makes sense. So I guess this is just a matter of waiting for these improvements to be released?

from image.

Related Issues (20)

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.