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

  • SEARCH
  • Home
  • 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 3666472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:53:04+00:00 2026-05-19T01:53:04+00:00

I encrypt, then decrypt an image that I then pass to my image util

  • 0

I encrypt, then decrypt an image that I then pass to my image util for resizing, (code graciously borrowed from somewhere) like so:

public static Bitmap loadResizedBitmap(InputStream dis, int width, int height) {

    BufferedInputStream bis = new BufferedInputStream(dis);
    Bitmap bitmap = null;
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeStream(bis, null, options);
    if (options.outHeight > 0 && options.outWidth > 0) {
        options.inJustDecodeBounds = false;
        options.inSampleSize = 2;

        while (options.outWidth / options.inSampleSize > width && 
                options.outHeight / options.inSampleSize > height) {
            options.inSampleSize++;
        }
        options.inSampleSize--;
        bitmap = BitmapFactory.decodeStream(bis, null, options);
    }
    return bitmap;
}

The issue is during the second decodeStream, the BitmapFactory returns null. I have verified the first one works, and outputs the correct size, etc. My guess is that CipherInputStream does not support mark and reset, so I wrapped it in a BufferedInputStream with no luck. Does anyone else have any suggestions?

  • 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-05-19T01:53:04+00:00Added an answer on May 19, 2026 at 1:53 am

    [ANSWERED]

    I switched it to use BitmapFactory.decodeByteArray and that solved it. I took another look at the API and I was able to pass along a byte[].

    My takeaway is CipherInputStream does not support mark() and reset().

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

Sidebar

Related Questions

I want to encrypt a image and then decrypt it. Is there any good
I want to encrypt some json from a server and then decrypt it on
I'm trying to encrypt some data from python (Google App Engine) and then decrypt
I tried to encrypt an array then decrypt it back to string by calling
I have a dictionary object which i would like to encrypt, then put it
I want to encrypt a message such as 'HELO1234 and then decrypt to get
I'm trying to encrypt a text file using Perl and then decrypt it using
I'm trying to encrypt some (cookie) data in C# and then decrypt it in
I have to encrypt the output file in A application, then decrypt it in
When I encrypt a string then immediately decrypt, the CCCryptorStatus is -4304 and the

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.