These forums are CLOSED. Please visit the new forums HERE
Any way to obtain texture deminsions from a script? |
|
Chris Wilde
Custom User Title
![]() Join date: 21 Jul 2004
Posts: 768
|
04-26-2005 19:30
If I uploaded a 200x400 pixel texture, is there a way to find out those deminsions once its uploaded? Basically Im curious about a script that would take a texture, find out its deminions and scale an object porportionately to those deminsions automatically. Meaning, the object would scale to 2m x 4m (or a similar ratio) to match the 200x400 pixel size/ratio. But if the information isnt available then Im out of luck.
|
Judah Jimador
Registered User
Join date: 13 Mar 2005
Posts: 230
|
04-26-2005 19:46
If I uploaded a 200x400 pixel texture, is there a way to find out those deminsions once its uploaded? Basically Im curious about a script that would take a texture, find out its deminions and scale an object porportionately to those deminsions automatically. Meaning, the object would scale to 2m x 4m (or a similar ratio) to match the 200x400 pixel size/ratio. But if the information isnt available then Im out of luck. Chris, I'll be curious what responses you get from others; maybe they'll correct me. But AFAIK there's no way to do it directly. A possible workaround that occurs to me is to include your dimensions in the texture name. If you drop the texture into the inventory of your object, rather than just painting it on with the editing tools, I think you can use LSL functions to read the names and break the dimensions out for your script, e.g. "redbrick_200_400" Good luck! -- jj |
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
04-27-2005 00:49
I think you might also find that the textures resize to powers of 2 pixels on each side. I *think* you're looking at 512X256 for 400 X 200, although it could be 256X128. That happens to work for that one, but 300X200 would be 256 square or 256X128, quite different proportions.
I think if you want to do it the scripted way then putting the original dimensions in the name might be the only way. If you can and will dig around by hand there's also a description line on textures, you could store it in there, but I don't think LSL can see that. |
Pete Fats
Geek
![]() Join date: 18 Apr 2003
Posts: 648
|
04-27-2005 01:00
Judah is prolly on to something....as far as your upload goes, it will be converted into a power of 2, but other then that, will remain at the resolution you save it at. If you want to change the size of the prim based on the resolution the file is, name would be the best solution.
_____________________
![]() |
Ace Cassidy
Resident Bohemian
![]() Join date: 5 Apr 2004
Posts: 1,228
|
04-27-2005 04:49
What you really need to know is the original aspect ratio of a texture so that it can be painted onto a prim with the same ratio, causing the image not to be distorted along one of the 2 axes.
But to answer your question, there is no way to get this via a script. I ran into this problem when I was uploading the pics for the Iraqi War Memorial. I didn't want to dishonor these men and women by displaying their faces all distorted. To solve it, I manually created a notecard that has the dimensions of each pic, and then I resize the prim appropriately when I go to display the texture. - Ace _____________________
"Free your mind, and your ass will follow" - George Clinton
|
Malachi Petunia
Gentle Miscreant
![]() Join date: 21 Sep 2003
Posts: 3,414
|
04-27-2005 08:01
...To solve it, I manually created a notecard that has the dimensions of each pic, and then I resize the prim appropriately when I go to display the texture. |
Jeffrey Gomez
Cubed™
![]() Join date: 11 Jun 2004
Posts: 3,522
|
04-27-2005 08:22
In my experience, the only way to do this easily would be to rename the actual picture files to reflect their size or by writing a script in VB/C++/Whatever to do this for an entire folder and uploading it like that.
While textures are converted into a "power of two" in pixels in Second Life, this factors out because it's distorting the image to place it in this format to begin with. Having access to pixel data, in SL at the LSL level, would be rather pointless since you're still not seeing what the aspect ratio originally was. That said, you can have a look at the ratios of uploaded textures, by partial key value, in the Debug menu Texture Browser. Don't think it's called exactly that, though. _____________________
---
|
Francis Chung
This sentence no verb.
![]() Join date: 22 Sep 2003
Posts: 918
|
04-27-2005 08:45
Textures are always downsampled to the closest power of 2 when uploaded to SL.
So for example, a 1023x512 texture will be converted into a 512x512 texture. _____________________
--
~If you lived here, you would be home by now~ |
Tya Fallingbridge
Proud Prim Whore
![]() Join date: 28 Aug 2003
Posts: 790
|
04-27-2005 10:07
Not sure if anyone noticed.. when you go to texuture an object.. not dragging and dropping the textures... the new feature that came with 1.6.. it will show under the texture picture window the size of the dimensions.
|
Zalandria Zaius
Registered User
Join date: 17 Jan 2004
Posts: 277
|
object descriptions
04-27-2005 11:08
We can read and write to the description now so this might be a good place to store the dimensions of the texture.
|
Shadow Weaver
Ancient
![]() Join date: 13 Jan 2003
Posts: 2,808
|
04-27-2005 11:08
Not sure if anyone noticed.. when you go to texuture an object.. not dragging and dropping the textures... the new feature that came with 1.6.. it will show under the texture picture window the size of the dimensions. Tya while this is true what Francis noted is the compression ratio upload schematic. 32 64 128 256 512 1024 and any combinations therin. Such as you can have a image 100 x 52 and it will size down to 64 x 32 ect. based on orginal dimensions. Once its converted the list you mention relates the SL optimized image size. Shadow _____________________
Everyone here is an adult. This ain't DisneyLand, and Mickey Mouse isn't going to swat you with a stick if you say "holy crapola."<Pathfinder Linden>
New Worlds new Adventures Formerly known as Jade Wolf my business name has now changed to Dragon Shadow. Im me in world for Locations of my apparrel Online Authorized Trademark Licensed Apparel http://www.cafepress.com/slvisions OR Visit The Website @ www.slvisions.com |