Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:05:24+00:00 2026-06-11T22:05:24+00:00

I’m using ImageMagick to do some image manipulation. I’m trying to stream a file

  • 0

I’m using ImageMagick to do some image manipulation. I’m trying to stream a file from a service that returns an input stream and do image manipulation on the fly without letting the file hit the HDD.

When I convert the input stream to file using InputStream, OutputStream, FileOutputStream classes, the resulting file size is the same as the file that’s stored on the service (initial file size is 9 MB). This is fine. When I run the input stream thru ImageMagick, even though I haven’t done any manipulations, the resulting file is way smaller (2 MB). I’m not sure what I’m doing wrong or if ImageMagick is doing something to the file without me knowing. Here’s the snippet of my code:

IMOperation op = new IMOperation();
ConvertCmd convert = new ConvertCmd();

InputStream is = s.getFileFromBucket(BUCKET, filename);
op.addImage("-");  // read from stdin
op.addImage(outfile);
Pipe pipeIn = new Pipe (is,null);
convert.setInputProvider(pipeIn);
convert.run(op);
is.close();

So I expected the file to be the same size going out as it was coming in since I haven’t done anything to it yet but it’s smaller.

Someone had suggested perhaps the service died midway thru while streaming and that’s why the file is so small. I don’t think this is the case because every test I’ve run with it going thru ImageMagick, the output file size is the same (2 MB). Also, when I use my viewer to look at the resulting file, it displays the file without problems. Lastly, when I convert the input stream to file, that always results in a file that’s 9 MB and displays fine with the viewer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:05:25+00:00Added an answer on June 11, 2026 at 10:05 pm

    Jpeg is a compressed format, Imagemagick is doing some compressions automatically.

    See: http://www.imagemagick.org/Usage/formats/#jpg

    “As the JPEG quality gets lower, the size of the image also gets smaller. The default quality setting, when no JPEG quality is set, either by the user, or from the source image format file, is about 92%, which is a very high quality.”

    Maybe your input Jpeg is lossless -> 100%

    EDIT: you can test this by taking the original picture and saving it as jpeg with an arbitrary image processing program by setting the compression rate to 92. Just compare the filesizes afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.