Coder Social home page Coder Social logo

Comments (3)

foresterre avatar foresterre commented on August 29, 2024

Rather than write an output file to temp can a processed image be returned via stdout ?

For individual files, you can do the following to get a blob:

sic --output-format png --input .\resources\logo\sic_500.jpg --resize 200 200 >> out.png

Files which use --glob-input currently always require --glob-output to be present, and this mode doesn't currently support stdout.

Looking at your paths, I think you're on Windows; as a workaround you could use the following Powershell:

Get-ChildItem -Recurse ".\resources" -Include "*.jpg","*.jpeg","*.png" | ForEach-Object { sic --input $_.FullName --output somedir/$($_.Name) --resize 200 200 }

For your directories:

Get-ChildItem -Recurse "G:/Temp" -Include "*.jpg","*.jpeg","*.png" | ForEach-Object { sic --input $_.FullName --output C:/Users/Paul/AppData/Local/Temp/youdocms/$($_.Name) --resize 200 200 }

after about 70 files I get format error but no file ref. The directory does inc files other than jpg,jpeg and png.

That's not good! I should improve the error message and/or add a flag to allow for (silent/with a warning to stderr) failures.

If you still have the exact error that would be helpful :).

Rather than write an output file to temp can a processed image be returned via stdout ?

Say that I would implement this, in what way would you expect the different images to be output? i.e. if you have a stream of byte buffers, how do you:

A) know the type of the output file* (e.g. png, jpg, bmp), and
B) know where one image ends, and the next begins (e.g. a next line in jsonlines).

* some are guessable by their file header

from sic.

toomanylogins avatar toomanylogins commented on August 29, 2024

Thank you for reply. I have this working via blob or file and looping through the files. Not getting the format error. I will try to track down the file that is causing the problem if I try to process a directory.

However if using individual files with blob output the blob is only created if the output format matches the input.

sic.exe --output-format jpg --input "G:\Temp\test\IMG_6344.PNG" --resize 200 200 >> empty blob

The error is as follows.

Error: Unable to save image.

Caused by:
0: The decoder for Jpeg does not support the color type Rgba16
1: The decoder for Jpeg does not support the color type Rgba16

if the output format is png with same file the blob is returned.

from sic.

foresterre avatar foresterre commented on August 29, 2024

after about 70 files I get format error but no file ref. The directory does inc files other than jpg,jpeg and png.

That's not good! I should improve the error message and/or add a flag to allow for (silent/with a warning to stderr) failures.

I added error context in #1555.
Released as 0.22.2.

from sic.

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.