I'm displaying an artist image from the last.fm API and I want to crop it at 75 pixels height, but I want it to be the full width. When I do ImageCrop=0,0,0,75,1 it is not displayed. If I set a width, it stretches it.
Is there any way to complete ignore the width? I just want it to be 75 pixels high, native width and preserve the aspect ratio.
It is currently April 28th, 2024, 9:54 am
ImageCrop height only?
-
- Posts: 19
- Joined: June 21st, 2012, 5:23 am
-
- Posts: 19
- Joined: June 21st, 2012, 5:23 am
Re: ImageCrop height only?
For now I just created a second image with alpha 0 that has no width or height set. When it retreives the image it obviously sets the height of the meter accordingly. I then use an LUA script to get the width and set a variable that I later use to crop...
Pain in the butt, I wish I could just do ImageCrop=0,0,*,75,1 but oh well
Pain in the butt, I wish I could just do ImageCrop=0,0,*,75,1 but oh well
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
Re: ImageCrop height only?
I don't think there is any way you can set the Height to 75 pixels AND keep the original width AND preserve the aspect ratio. If you want Height=75 and Width=Original Width, I don't think there is any alternative to using a LUA script to get the 'W' value to use in ImageCrop.ScottBeeson wrote:Is there any way to complete ignore the width? I just want it to be 75 pixels high, native width and preserve the aspect ratio.
.ini file
Code: Select all
[Variables]
CropHeight=75
PicWidth=75
[DummyDisplay]
Meter=IMAGE
ImageName=MyImage.jpg
X=-5000
Y=-3000
[GetPicWidth-Lua]
Measure=Script
ScriptFile=GetPicWidth.lua
[ShowCroppedImage]
Meter=IMAGE
ImageName=MyImage.jpg
ImageCrop=0, 0, #PicWidth#, #CropHeight#
DynamicVariables=1
Code: Select all
function Update()
Meter = SKIN:GetMeter('DummyDisplay')
Width = Meter:GetW()
SKIN:Bang('!SetVariable', 'PicWidth', Width)
end