ActiveDen

Generating thumbnails fom MovieClips

563 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • Brazil
  • Referred between 1 and 9 users
LuizZak says

Hey guys!

Does anybody knows how to generate a thumbnail from a movieclip keeping the aspect ratio? I’d like to create 60×45 BitmapData thumbnails keeping the aspect ratio. Any idea or tip?

3 years ago
3340 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Italy
doru says

some starting info here it should be what you looking for.

3 years ago
563 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • Brazil
  • Referred between 1 and 9 users
LuizZak says
some starting info here it should be what you looking for.

Yeah, I’m aware of this, but what’s kiling me is the math to size the MC down. I’ve tried some via the input matrix, but it had some issues.

3 years ago
1945 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Bought between 10 and 49 items
  • Netherlands
  • Referred between 10 and 49 users
Emroni says
What about sizing it down like this:
mc._width = 60;
mc._yscale = mc._xscale;
if(mc._height < 45){
     mc._height = 45;
     mc._xscale = mc._yscale;
}

and then apply a mask on top of it, which is 60×45. That should give the result you want. If that isnt exactly what you want, you might want to check out the BitmapData.copyPixels() function.

3 years ago
4243 posts
  • Has been a member for 3-4 years
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
Aw_Shucks says

Emroni, I can’t figure it out. I’m just gonna ask so I know. Why would you apply a mask over it?

3 years ago
4324 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
Reaper-Media says
Emroni, I can’t figure it out. I’m just gonna ask so I know. Why would you apply a mask over it?
Ben, bear with me, I’m about to give you the most useful information I have EVER 1 given anyone, so bear with me… You ready, here it is:

Why Not?

:)

1 I did once tell my shoe how to do it’s own laces up.

3 years ago
Reaper-Media is a moderator
3340 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Italy
doru says

you don’t need to scale the mc. from the link:

“The source display object does not use any of its applied transformations for this call. It is treated as it exists in the library or file, with no matrix transform, no color transform, and no blend mode.”

create your bitmapdata (A) from the movieclip. then copy from this bitmapdata (A) to another bitmapdata ( B ) using a rectangle that have the same proportion as your final dimension. Scale this bitmapdata ( B ) down to the final dimension.

3 years ago
1945 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Bought between 10 and 49 items
  • Netherlands
  • Referred between 10 and 49 users
Emroni says
Emroni, I can’t figure it out. I’m just gonna ask so I know. Why would you apply a mask over it?

He was asking for a new movieclip with a thumbnail in it, right? With the dimensions 60×45. Well, lets take an example: Our image is 120×100 pixels. To get it down to 60×45, he will have to scale it down. But if you scale it down by 50%, it becomes 60×50, which is 5 pixels too high. But if you scale it down more to get rid of the 5 pixels, it will be less than 60 pixels wide. Because it is too high, I said he should have a mask on top of it, to mask off those extra pixels. Catch my drift?

3 years ago
4243 posts
  • Has been a member for 3-4 years
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
Aw_Shucks says

Okay, that’s KINDA what I figured it to be for. The mask would act as a dimensions framework for the mc, for lack of better terms, but since it is invisible the extra space needed to provide for the difference would not be obviously apparent. Do I get it? Oh alright, to mask off the extra space on the SIDES right?

3 years ago
1945 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Bought between 10 and 49 items
  • Netherlands
  • Referred between 10 and 49 users
Emroni says
Oh alright, to mask off the extra space on the SIDES right?

Yup, exactly that.

But if he doesnt want to have those extra pixels in there (because they mess up the mc._width part), he could look up the .copyPixels() function, which you can use to copy bitmapdata pixels, and use the right dimension without the use of a mask or extra pixels.

Although you could also use the mask._width, instead of the mc._width, since the mask is the part that is shown anyway. Just a tip though :) Oh, and one more: it looks better if you center the thumbs too, because when theyre slighty bigger, it would still look good, and not show just a side portion of the image.

3 years ago
by
by
by
by
by