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 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 some json from a server and then decrypt it on
Suppose that a group wants to encrypt some information, then share the encryption key
I tried to encrypt an array then decrypt it back to string by calling
I've created this program that can encrypt a found file and then it can
I have a need of a function/library that can quickly encrypt an image on
How can I encrypt a web.config file? And how can I then decrypt it
I have a CryptoAPI code to encrypt\ decrypt given data using AES-128 and a
We have a build process that needs to decrypt a password which it then
I'm writing a program that, using Rijndael, will encrypt and decrypt files/folders using a
I would like to encrypt strings which could potentially only be about three or

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.