Cropping a Picture by Script / Eventing / Plugin

Is there any way I can crop a picture, specifically a character bust, by script / eventing / plugin? I have a character bust which I want to display in different heights for different scenes. I know that I can create multiple character busts of different heights by photoshop, but if possible I would prefer to do it from one single bust to minimize the game size.
Is there any way I can crop a picture, specifically a character bust, by script / eventing / plugin? I have a character bust which I want to display in different heights for different scenes. I know that I can create multiple character busts of different heights by photoshop, but if possible I would prefer to do it from one single bust to minimize the game size.
Assume there is a plugin to do that, you will save a very very small size of images (about few hundred Kb) but your game performance will get reduced as well because it has to deal with cropping, caching your images. Reduce few Mb of game size in exchange of the game's performance? probably not
but your game performance will get reduced as well because it has to deal with cropping, caching your images.
Are you sure about this? It sounds like a spurious claim to me, but if you have evidence for it then it would be good to see.
I think it would be better to load 1 image into memory than multiple if it can be avoided. After all, the icons, facesets, sprites, tiles, etc. are all cropped from a larger image and performance is fine.

@zimzim are you talking about images inside a window or not inside a window? The way to do it is different between those cases.
Also, if you can describe how you show the bust now that would help (Show Picture command or plugin or script call?)
@VeryXInh I have about over a hundred busts for each character, and to make each bust in multiple sizes, say about 8 different sizes, would definitely shoot up the game size. Each bust is about 150 KB, so to estimate the size: 100 busts x 10 characters x 8 sizes x 150 KB = 1,200,000 KB = 1172 MB! That's a lot compared to having just one size for each bust (~147 MB ). Not to mention my project picture folder will be more difficult to browse through!

@Aloe Guvner Now that I think about it, it's probably more like a window.

Spoiler: Cutscene 1
Iqm1nMi.jpg

Spoiler: Cutscene 2
h7tI0MR.jpg

In Cutscene 1, if you look at the blonde girl, her portrait is not the same as in Cutscene 2. This is the variation in bust sizes that I'm talking about.

The way I show the bust is simply by Show Picture. No plugins were involved in this.

As you can see, I don't want the character portrait to extend below the gray frame in Cutscene 1 and the yellow frame in Cutscene 2. Otherwise, it'll disturb the text message. So, I'm not sure if this is like a window or not. To fit each portrait within the frame, I play with the size, the X, and the Y axis of the portrait.

Also, now that I think about it, is there a way that I can make a cut-off point for displaying the portraits? For example, in the picture below, I would like the portrait not to show beneath the red line. The reason why I'm asking this is that I may make some simple animation with the portraits, such as jumping up. If the portrait is cropped exactly at the bottom frame, then this will make the portraits jump up without showing the rest of the bottom body part.

Spoiler: Example Picture
DeREdjy.jpg
I wrote a plugin that gives you a plugin command to crop a picture.

Code:
CropPicture [pictureId] [x] [y] [width] [height]

Example: If you wanted to crop this picture to only show the dashing gentleman with the blonde hair
upload_2019-1-19_9-31-7.png


Links:
MV v.1.6.0+ (recommended)
Older version of MV (1.5.2 and older)

The automatic cropping below a certain line is more tricky. It would involve checking each frame if the picture's y coordinate + height is greater than the dotted line, and updating the crop of the picture. It's possible though, if I come up with a good solution I'll share it.
@Aloe Guvner Wow! Thank you very much for your kind effort to assist me. I really appreciate it! 😀

I've tried out the plugin (RPGMaker MV 1.5.2), but ran into an error:

Spoiler: Error Message
61cuGKs.jpg

What I did was I put the plugin command right after the Show Picture command:

Spoiler: Event Editor Content
i8KvuVa.jpg


Perhaps the way I wrote the plugin command is wrong? Do the x and y positions in the command refer to the x and y positions on the picture itself or the screen? Either way, I still receive the same error message. The original size of the picture is 337 x 697 by the way.
I had used a feature of Javascript that is not available in old versions of MV. I added a fill for it and updated the plugin, you can download it again from the same link.

I also added a plugin command to reset the cropping, as well as an option in the plugin parameters if you want to reset the cropping when Erase Picture is used (or keep the cropping despite Erase Picture).
It works like a charm now! Thank you so much @Aloe Guvner 🤣 The added feature to reset the cropping is also very useful. I'd definitely put you in my game credits + free key for you when the game is released. 🙂

Here's hoping that you will also found a solution to the 'autocrop beyond certain line' next. 😀

Original thread: https://forums.rpgmakerweb.com/threads/cropping-a-picture-by-script-eventing-plugin.104603/