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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:02:08+00:00 2026-05-25T02:02:08+00:00

Here’s my problem, I need to scale and clip images into square sized tiles

  • 0

Here’s my problem, I need to scale and clip images into square sized tiles to put into a tile list. Here’s how I want it to work:

  1. I want all my tiles to be, say, 300px x 300px.

  2. For each image, I want to scale the shorter side (either width or height) to fit in the tile using the “letterbox” scaleMode (so that it maintains aspect ratio).

  3. Then I want to position the image in the center and clip away anything left over from either both sides or the top and bottom.

Here’s an example to help clarify:

  • I have an image with width=600px and height=1200px. First I want to scale the image to width=300px and height=600px (notice that aspect ratio is maintained), then center the image vertically and clip the image to 300 x 300.

Is this possible? This is actually a pretty standard way of displaying square thumbnails in many photo-based web sites, but I can’t find a way to make it work in flex.

Any help would be appreciated, thanks!

UPDATE JUNE 2012:

Just in case anyone finds this thread now, this issue has been resolved in the latest version of the Flex SDK. On the spark image object there is a new scaleMode of “zoom” which does exactly what I’ve asked for here.

  • 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-25T02:02:09+00:00Added an answer on May 25, 2026 at 2:02 am

    Take your big image and draw it on BitmapData with scale and reposition:

    const zoom:Number = Math.max(THUMB_WIDTH/image.width, THUMB_HEIGHT/image.height);
    const x:int = (THUMB_WIDTH - image.width*zoom)/2;
    const y:int = (THUMB_HEIGHT - image.height*zoom)/2;
    var matrix:Matrix = new Matrix;
    matrix.scale(zoom, zoom);
    matrix.translate(x, y);
    
    var _thumbBitmap:BitmapData = new BitmapData(THUMB_WIDTH, THUMB_HEIGHT, false, 0xFFFFFF);
    _thumbBitmap.draw(image, matrix, null, null, null, true);
    

    Then assign resulting BitmapData to the source of the BitmapImage.

    More: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#draw%28%29
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/BitmapImage.html#source

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

Sidebar

Related Questions

Here is my problem...I have a page that loads a list of clients and
Here's a problem I ran into recently. I have attributes strings of the form
Here is an example of what I need http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html I need interactive list to
Here's the thing: I want to add some images programmatically. The images should have
Here is my project Here I want to insert something into my database. I
here is a debatable question which i want to achieve not sure how .
Here is my problem : I have a post controller with the action create.
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here is a screenshot of the problem (in IE): http://img401.imageshack.us/img401/7580/screenield.jpg The above effect -

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.