HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: Adil on 2021-02-24 12:42:08

Title: Component to resize album art
Post by: Adil on 2021-02-24 12:42:08
Hi there.

Would anyone know if there is any component capable of resizing the album art inserted in the tags of the audio files?

Some devices I use only accept 500x500 px resolution...

Thanks in advance.
Title: Re: Component to resize album art
Post by: Sponholz on 2021-02-24 13:56:26
Hi! This is one thing I'm also looking for, would be nice if there was a component that, not only, resizes but also converted PNG to JPG.

Cheers.
Title: Re: Component to resize album art
Post by: Xin-Hong on 2021-02-24 18:09:17
Not a component but mp3tag can do it: right click on the cover > Adjust cover
Title: Re: Component to resize album art
Post by: Adil on 2021-02-24 18:45:55
Yes. TagScanner does that too.

However, I mean an internal feature for foobar2000, without relying on third party software. Something like a component with the ability to run through a simple custom icon.

In very large libraries, the savings would be thousands of clicks.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-02-25 01:33:23
Since I've already made a component that can scan and report the dimensions of embedded covers already, I guess it would be fairly easy to make a new component resize that art. I'll think about it.

However, it's nonsensical to think other programs would require "thousands of clicks". I'm sure they handle large batches of items with ease.
Title: Re: Component to resize album art
Post by: Adil on 2021-02-25 02:46:05
@snotlicker

I use your component, it is very very very useful, thanks a lot for that!!!

"Thousands of clicks": I run TagScanner through a custom icon that I inserted in foobar2000. On the one hand, it gives me full control of the file organization without having to open and close other software, since TS works very well in parallel with FB. On the other hand, every time I need to resize the art covers, there is a sequence of clicks from that icon. In a library as large as the one I'm trying to organize, it would be much more convenient to resolve "automatically" through a component. One click and you're done.

I would not like to use TS to organize my files. foobar2000 is the software that I like to use for this task. Therefore, If I liked to use only TS, this task would be simple, maybe even faster than the existing function in MP3tag. But, as I said, I like to use foobar2000, this is the tool that I feel comfortable with.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-02-25 10:02:40
Here's a BETA version to try. I would test on copies of files first.

https://github.com/marc2k3/foo_jscript_panel/wiki/files/foo_cover_resizer.fb2k-component

Requires fb2k v1.6 or later, Windows 7 or later.

Use the context menu>Cover Resizer>Resize.
The max size dialog will not let you enter anything less than 200 (px).
You can preserve the original file type or write as JPG or PNG. WEBP is not supported.
Any images already smaller than the specified max size are ignored.
Title: Re: Component to resize album art
Post by: Adil on 2021-02-25 12:27:28
Nice!!! I'm going to check this out!!! :D

EDIT: It works!

First foo_cover_info came and now this... I just have to say that you are making life a lot easier for many users around here, I'm sure of it!

Thank you very much for your involvement and dedication in this topic! For my part, your solution was even better than I expected, with more functions!

However, would there be any way to enable the resizing with just a single click, that is, to fix a predetermined size in the component's settings and when executing it, the resizing will already be applied?

Your solution with the current configuration is very good and useful, it would not be necessary to sacrifice it, I would just like to know if there was any way to just coexist this solution with the one I mentioned above.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-02-25 12:32:43
I just uploaded Beta.2. There was a little glitch in how files were skipped depending on existing image size in Beta.1
Title: Re: Component to resize album art
Post by: Adil on 2021-02-25 12:54:16
The photo size (in KB) is much larger than the original in some tests here.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-02-25 13:41:24
edit: Beta.3 now uploaded, same link as before.

https://github.com/marc2k3/foo_jscript_panel/wiki/files/foo_cover_resizer.fb2k-component

This time JPG compression settings are left default (whatever that is) and should always be smaller.
Title: Re: Component to resize album art
Post by: Adil on 2021-02-25 14:05:32
Thanks! :D
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-02-25 14:18:29
Regarding settings,, they should always persist from the previous use so assuming you've changed something from the default, it will always be there next time without a Preferences page. Just a simple OK confirmation each time you use it isn't exactly a hardship.
Title: Re: Component to resize album art
Post by: Adil on 2021-02-25 14:35:37
Better than that, impossible. My most sincere thanks, you solved my initial question with honor on the merit! ;)
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-02-26 10:34:41
Beta.4 uploaded: https://github.com/marc2k3/foo_jscript_panel/wiki/files/foo_cover_resizer.fb2k-component

This reports how many files were successfully updated in the Console.
Also, it has partial WEBP support. It can read and resize WEBP but only write it back as JPG or PNG. It cannot write WEBP.
Title: Re: Component to resize album art
Post by: Adil on 2021-05-06 00:17:19
Does the component no longer have a website?
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-05-06 20:07:45
The link in the previous post should be live again.
Title: Re: Component to resize album art
Post by: always.beta on 2021-08-22 13:09:50
Beta.4 uploaded: https://github.com/marc2k3/foo_jscript_panel/wiki/files/foo_cover_resizer.fb2k-component

This reports how many files were successfully updated in the Console.
Also, it has partial WEBP support. It can read and resize WEBP but only write it back as JPG or PNG. It cannot write WEBP.
Is it possible to add, without changing the image size, only changing the image format and compressing the size?
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-08-22 18:35:14
Currently it's possible to read/write png/jpg/tiff/bmp/gif but I doubt anyone is using the last 3 for embedded album art. I guess PNG to JPG might save some space. Saving as webp would be nice but I already mentioned above I don't how do to do that. I'm sure there are zillions of examples out there but I'm lazy not to mention incompetent.
Title: Re: Component to resize album art
Post by: always.beta on 2021-08-23 01:06:48
I have some album covers in png format that I want to convert to jpg format, but without changing the height and width of the covers, only the image format and file size.
Still thank you very much for making this plugin, it has been excellent.
Title: Re: Component to resize album art
Post by: sveakul on 2021-08-23 02:45:15
I have some album covers in png format that I want to convert to jpg format, but without changing the height and width of the covers, only the image format and file size.
Just FYI, you can do this easy in Mp3tag by right-clicking the image and choosing "adjust cover."  It will give you the option to change to jpg at a chosen compression level and maintain dimensions.
Title: Re: Component to resize album art
Post by: kode54 on 2021-08-24 01:37:22
I'm sure there are zillions of examples out there but I'm lazy not to mention incompetent.
I wouldn't call you either of those things. The process of using libwebp to create images is probably not exactly straightforward. You've already done considerable work just supporting batch resizing.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-08-24 07:54:55
I have some album covers in png format that I want to convert to jpg format, but without changing the height and width of the covers, only the image format and file size.
Still thank you very much for making this plugin, it has been excellent.

I'll consider this because it only requires a new menu item. I was reluctant to expose any compression options like mp3tag because building dialogs is the biggest headache for any component I've dabbled with compared to the relatively straight forward task of extracting/writing embedded images which the SDK makes very easy. If I implement it, I'll post back with an update.


Title: Re: Component to resize album art
Post by: always.beta on 2021-08-24 12:52:04
I'll consider this because it only requires a new menu item. I was reluctant to expose any compression options like mp3tag because building dialogs is the biggest headache for any component I've dabbled with compared to the relatively straight forward task of extracting/writing embedded images which the SDK makes very easy. If I implement it, I'll post back with an update.
I think the current compression works just fine, and don't need any extra menu setting items. just want to change the image format to jpg while retaining the original size(width × height).
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-08-24 13:21:47
Behold.... v0.0.2.

https://github.com/marc2k3/foo_jscript_panel/wiki/files/foo_cover_resizer.fb2k-component

As an extra bonus, it has an option to remove all EXCEPT front. There is a new Cover Utils menu as putting them under Cover Resizer looked wrong.

Title: Re: Component to resize album art
Post by: Adil on 2021-08-24 18:41:34
Thanks for that!
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-08-24 23:50:31
The previously posted download links in this thread are now dead. Check the new link in my signature.
Title: Re: Component to resize album art
Post by: always.beta on 2021-08-25 03:50:45
Thanks for that! It worked very well. 👍👍👍
Off topic, could "the convert the front cover to JPG without resizing" feature be enhanced a bit more? For example: (1)cover.png, 5.5MB, 2000×2000px→cover.jpg, 550kb, 2000×2000px;(2)cover.jpg, 5.5MB, 2000×2000px→cover.jpg, 550kb, 2000×2000px.
Title: Re: Component to resize album art
Post by: Adil on 2021-09-16 19:33:25
Hi there.

Would it be possible to condense "Attach Front Cover" and "Cover Resizer" into a single component?

I would like a component that attaches front album cover to audio files, so that in the act of attaching it would already be possible to decide the size of the cover.

Thanks for the attention.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-16 19:55:47
I can probably do that. It would be browsing for a single file and resizing/attaching it to a selection. I'm not doing anything like the existing "batch attach" option.
Title: Re: Component to resize album art
Post by: Adil on 2021-09-17 00:38:46
Thanks for reading my request.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-17 11:24:36
I thought it would easy to integrate but my original code was such a mess it's turning out to be more effort than I thought. I'm working on it!
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-17 17:09:00
Test this on copies of files first. It's marked as a beta!

https://github.com/marc2k3/fb2k-component/releases
Title: Re: Component to resize album art
Post by: Adil on 2021-09-17 22:25:58
What's the name of the component?

EDIT: foo cover resizer

I'm going to do a lot of tests, thanks!
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-17 22:49:42
Make sure you have the beta version uploaded today. By default GitHub hides "pre-release" files and you need to click on "Assets" link to reveal it. You don't want the old version from last month.
Title: Re: Component to resize album art
Post by: Adil on 2021-09-17 23:33:54
I've tested it on virtually all audio formats using various picture formats, the component is fast and obedient. It is becoming one of the most useful components for foobar2000! I made single and batch attachments, no failures detected.

I still wondered if it would be convenient to suggest to this component a checkbox with the option "Remove all except front", but looking closely at its proposal, I believe that would go beyond its nature.

In summary, this component was very good and is now excellent. My most sincere thanks for having answered one more request on my part.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-17 23:45:36
Remove all except front already exists since the previous version. It's found under the Cover Utils submenu.

It just goes to show no one likes readme files.   :))

https://github.com/marc2k3/fb2k-component#foo_cover_resizer
Title: Re: Component to resize album art
Post by: Adil on 2021-09-18 00:33:05
Well... I have nothing to add then... I use this feature, I just thought it was contained in another component of yours, I forgot it was the same...  :-[

This component deserved to be listed in the official list of components of foobar2000. It is one of the most useful ones available right now. The same goes for foo_cover_info.

@snotlicker
You have made excellent contributions to the foobar2000 user community, THANK YOU VERY MUCH!
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-18 01:02:13
Thanks for the nice words but all the hard work is done by Peter, the developer of foobar2000. The foobar2000 SDK (software development kit) makes these things far simpler than they should be. There is no way I could add this functionality without the easy to use methods he provides.

I don't have to know or care about the target files if they're mp3/flac/m4a/whatever. I can't even begin to imagine how much code there is behind the scenes doing the actual work. We don't get to see that part due to closed source nature of foobar2000 itself but I'm sure it was a tremendous amount of effort to write!
Title: Re: Component to resize album art
Post by: Adil on 2021-09-18 03:05:08
Which software is necessary to write components? Microsoft Visual Studio?
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-18 10:16:26
Yep. Some people might use other editors and maybe compile using command line tools but I stick with VS.
Title: Re: Component to resize album art
Post by: marc2k3 on 2021-09-21 23:50:32
Removed the beta label.

https://github.com/marc2k3/fb2k-component/releases

Since it shares a page with other components, versions/dates are now shown for all.
Title: Re: Component to resize album art
Post by: zK on 2022-01-31 14:37:39
Hi.

When I try to resize an album cover to 600px, the component always resizes to 500px. Incidentally, this happens with any value above 500px.

The component works correctly, with the intended size, when it inserts a new cover art in a file without a previous cover art. The problem only occurs when modifying a cover already inserted in the audio file.

I use the latest version of the component.
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-01-31 16:51:39
Thanks for reporting. Should be fixed now.

https://github.com/marc2k3/fb2k-component/releases
Title: Re: Component to resize album art
Post by: zK on 2022-01-31 17:38:51
It works fine now, thanks.
Title: Re: Component to resize album art
Post by: Porcus on 2022-02-01 10:52:26
It just goes to show no one likes readme files.   :))
How long did it take until anyone discovered the 404 at https://github.com/marc2k3/fb2k-component/releases ?
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-02-01 11:18:51
Oops, I changed the branch name about a week ago. Thanks for spotting.
Title: Re: Component to resize album art
Post by: anamorphic on 2022-02-02 10:26:59
Another one? -
https://github.com/marc2k3/foo_jscript_panel/wiki#samples

Under "Samples" the 'Configuration Window' link redirects (but the one under "Docs" works)
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-02-02 10:41:07
Yup, that was broke for ages. Must be something I missed when converting my old github pages website in to a plain wiki. Thanks.
Title: Re: Component to resize album art
Post by: always.beta on 2022-02-22 11:20:56
@marc2k3 ,  Can you enhance the "Convert front covers to JPG without resizng" feature to only batch compress the cover file size, it doesn't matter if you convert the file format, you can compress png or jpg format.
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-03-07 04:00:03
You can try this BETA. Not sure it will do much....

https://github.com/marc2k3/fb2k-component/releases/tag/2022-03-07

Notes:
When resizing, JPG or PNG must be chosen. Keeping as tiff, bmp, gif is no longer supported.
Requirement for fb2k v1.6 has been dropped, it can run on v1.5.x
Now uses WIC (windows imaging component) instead of ye olde Gdiplus.

Title: Re: Component to resize album art
Post by: always.beta on 2022-03-07 06:20:31
The compression effect is exactly the same as the tools built into powertoys, and the effect is great! Thank you for your efforts, thanks!
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-03-07 07:14:14
Version bumped to 0.1.0 final. Same link as above.
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-03-08 00:14:56
0.1.1 fixes a minor regression where image decoding failures were not reported.

https://github.com/marc2k3/fb2k-component/releases/latest

Also, because the requirement for fb2k v1.6 was dropped, WebP is no longer supported natively. Windows 10/11 users should have WebP codecs installed via the store by default. Windows 7/8/8.1 users can install...

https://storage.googleapis.com/downloads.webmproject.org/releases/webp/WebpCodecSetup.exe

This makes it equal to Columns UI which has the same requirements. It also uses WIC for all image loading.

The readme summarises everything: https://github.com/marc2k3/fb2k-component#foo_cover_resizer
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-03-09 14:52:01
v0.2.0 has been released...

https://github.com/marc2k3/fb2k-component/releases

This version has WEBP writing support.

I've also updated the menu items so it's clearer what they do. Converting without resizing is no longer restricted to front/jpg. You can choose artist/back/disc/etc
Browsing for a file, converting and attaching without resizing is also a new addition.
Title: Re: Component to resize album art
Post by: marc2k3 on 2022-03-10 03:21:53
0.2.1 fixes a bug when converting types other than front still converted the front image.

In the previous release, I updated the menu items/dialog but forgot to update the bit of code that does the actual work. :/

https://github.com/marc2k3/fb2k-component/releases

There was no problem with the resizing code. That should have worked normally.




Title: Re: Component to resize album art
Post by: marc2k3 on 2022-03-14 09:03:49
0.2.2 has been updated to play nicely with my foo_cover_info component.

https://github.com/marc2k3/fb2k-component/releases

Quote
- If `foo_cover_info` is installed, updates are triggered automatically
when art is added, resized or converted by this component. `foo_cover_info`
itself remains dumb as a rock and has no clue when you add/remove art
via the standard `Properties` dialog or native `fooobar2000` context commands.