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 7750315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:15:31+00:00 2026-06-01T11:15:31+00:00

public final BufferedImage filter(BufferedImage src, BufferedImage dst) Transforms the source BufferedImage and stores the

  • 0

public final BufferedImage filter(BufferedImage src, BufferedImage dst)

Transforms the source BufferedImage and stores the results
in the destination BufferedImage.
If the color models for the two images do not match, a color
conversion into the destination color model is performed.
If the destination image is null, a BufferedImage is created with the source
ColorModel.
The coordinates of the rectangle returned by
getBounds2D(BufferedImage) are not necessarily the same as the coordinates of the
BufferedImage returned by this method. If the upper-left corner coordinates
of the rectangle are negative then this part of the rectangle is not drawn. If the
upper-left corner coordinates of the rectangle are positive then the filtered image is
drawn at that position in the destination BufferedImage.

I had the following code on Java 1.6:

//Make image always std_height tall
double scaleAmount = (double) std_height / (double) characterImage.getHeight();
AffineTransform tx = new AffineTransform();
tx.scale(scaleAmount, scaleAmount);
AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
characterImage = op.filter(characterImage, null);

In Android, i’m using Matrix instead of AffineTransform:

//Make image always std_width wide
float scaleAmount = (float) std_width / (float) characterImage.getWidth();
//AffineTransform tx = new AffineTransform();
//tx.scale(scaleAmount, scaleAmount);
Matrix mx = new Matrix();
mx.setScale(scaleAmount, scaleAmount);
//AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); //Can't use this on Android
//characterImage = op.filter(characterImage, null); //Can't use this on Android

My problem is with the last two commented lines. Can i do something like it on Android? Thanks.

  • 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-01T11:15:33+00:00Added an answer on June 1, 2026 at 11:15 am

    You can do something like

    Matrix m = new Matrix();
    matrix.postScale(scaleAmount, scaleAmount);
    Bitmap b = Bitmap.createBitmap(original, 0, 0, original.getWidth(), original.getHeight(), m, true);
    

    (Note: BTW, Oracle JavaSE AffineTransformOp#filter has a bug when the output BufferedImage is null, it creates a BufferedImage but with default colorspace, not the one of the input BufferedImage.)

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

Sidebar

Related Questions

I have two classes in short here they are: public final class ServerMain {
Consider this code from the official OpenJDK source of java.awt.font.TextLayout : public final class
Whi with this code public final String[] array_titoli_serie_prima = new String[]{ getResources().getString(R.string.titolo_p1), getResources().getString(R.string.titolo_p2), getResources().getString(R.string.titolo_p3),
I have a final member data: public final Foo foo; in the constructor, foo
Consider the following interface in Java: public interface I { public final String KEY
Lets assume following classes definition: public class A { public final static String SOME_VALUE;
I'm trying to make this code generic: public final Object unwrap(Class arg0) { throw
Are these methods getNewId() & fetchIdsInReserve() thread safe ? public final class IdManager {
public interface Proposal { public static final enum STATUS { NEW , START ,
Consider this case: public Class1 { public static final String ONE = ABC; public

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.