kazurayam / materialstore

A domain-specific file system to store "materials" (screenshots, HTML, JSON, XML) collected during End-to-End testings using Selenium WebDriver etc. Features to make "diff" and compiling HTML reports are also included. This is written in pure Java8
Apache License 2.0
0 stars 0 forks source link

want Store#write(JobName, JobTimestamp, FileType.JPEG, Metadata, BufferedImage) with float compressionQuality as param #429

Closed kazurayam closed 1 year ago

kazurayam commented 1 year ago

I want to save a BufferedImage object into the store as JPEG; while I need to apply compression to it to reduce the file size.

But, as of v0.16.4, the Store API does not allow me to specify the compression quality as param:

Material write(JobName jobName, JobTimestamp jobTimestamp, IFileType fileType, Metadata meta,
                   BufferedImage input) throws MaterialstoreException;

    Material write(JobName jobName, JobTimestamp jobTimestamp, IFileType fileType, Metadata meta,
                   BufferedImage input, Jobber.DuplicationHandling flowControl) throws MaterialstoreException;
kazurayam commented 1 year ago

The parameter Jobber.DupulicationHandling flowControl is not really useful.

The signature could be abstract one step higher:

Material write(JobName jobName, JobTimestamp jobTimestamp, IFileType fileType, Metadata metadata,
        BufferedImage input, WriteParameter writeParam) throws MaterialstoreException;

and the WriteParameter could include Jobber.DuplicationHandling as a property.

I can add compression quality as another property of the WriteParameter. More parameters could be allocated in the WriterParameter class.

kazurayam commented 1 year ago

I want to know what value is expected as valid "formatName" for ImageIO.write(...)

I found the following post:

Nice read.

kazurayam commented 1 year ago

done at 0.16.5-SNAPSHOT