Close
Ok Lets compress your scan/images
Greeting, otakus live in far away western worlds.
I am new to this forum and i am planning say hi by introducing a way to batch re-encoding your images into HEIC format which will save a lot disk space for you.

Note, this method can be lossless and lossy, it depends on how you set the parameters.

All you need is as following:
1. Powershell 7.0 +
This is available on Github here https://github.com/PowerShell/PowerShell/releases
Download the release for your pc and since normal Win10 already have a Powershell 5.1 on them, you may need to use > pwsh to call powershell 7.0 rather than > powershell as you would normally do.
2. Imagemagick
Maybe the most famous batch image processing software, it is a shame that the win10 version do not support heic encoing. This "infunction" is the only reason why this tutorial exist. On linux, you can just use imagemagick to do the trick. If you like, you can always install powershell and use my batch profile.
By installing imagemagick, you get a copy of a stable version of FFmpeg which is the core software we are using in this profile.
3.Mp4box in GPAC toolbox. Download it in https://gpac.wp.imt.fr/ this website.
Note the tool box comes in a entirety, but you can install mp4box separately.

Now you should have Mp4box, ffmpeg, imagemagick in your system PATH.
Verify these by typeing
> ffmpeg
> mp4box
> magick
in your terminal (by terminal i mean powershell 7.0 window)

In your PWSH (powershell) 7.0 termial, type > $profile to see where is your profile stored.
Normaly there will be no default profile.
If you have a file there, then you must be already a powershell user and you will know how to do my following instuctions in your own way.

Now, download https://github.com/GrandArth/Risi-Pwsh-Profile the ps1 file to the diertory you get from > $profile.
The page is mainly covered in Chinese since this is initially designed for my friends.
But i have some English comments in codes, if you have any question, remember you can ask me in English/中文/日本語 here.

Now open a pwsh7 window, if it display :

----------------
Please Use Powershell 7.0 + With This Profile
本配置文件应用于 PWSH7.0 环境.
This Profile is created by 冰箱研会长
____ ____ _ __ __
| _ \/ ___| / \ | \/ |
| |_) \___ \ / _ \ | |\/| |
| _ < ___) / ___ \| | | |
|_| \_\____/_/ \_\_| |_|
Before using any of these functions, Please backup your files or at least test the function once.
在使用任何函数之前, 强烈建议用户备份文件, 至少先用部分文件进行测试.
-------------

Then you are ok to go, just jump to the example usage section.

In a more common cases, you should receive a series of Error saying something like policy and authorizations.
Just type "> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser" to enable profiles and re-open pwsh7 and you will be fine.

So usages finally, my English writing skills are rusted!

Before actual conversion use:
> gtype "absolute path"
to see all types in your directory.
eg. gtype "D:\download"

>fimgconv "absolute path" $quality-factor $sourceformat $targetformat
eg: fimgconv "D:\desktop\111\222" 15 png heic

This convert all png files to heic. You must specify the source format, that why you need gtype.

Note if you images with odd size (width and height resolution) this method will cut one row/column of pixels to meet the encoding requirements.

>imgconv "absolute path" $quality-factor $sourceformat $targetformat

This version, do not delete but add a row/column of pixels of similiar color to meet the rules.
This is slower, since there will be an I/O procession for each odd files.

after the convertion, you will have heic files and source files in your directory.
Use
>mdel "absolute path" $format
to delete ones with format you don't want.
eg. mdel "D:\desktop" jpg

There is something else in that profile, but for HEIC this is the end.

Last

#1: To read heic files you may need 2 decoder plugin in win10 store, one named HEVC decoder (there is a free version) the latter named HEIF decoder.
Then you can view your heic file. (All apple device can decode heic files)

#2 to enable full colorspace conversion, use the line with yuv444 in comments to replace the one with yuv420.
The default is lossy in colorspace conversion (on colors), but the yuv444 lossless version can not be decoded on win10 PCs.

So that's it.
Thx for reading.
If you encounter any issues, Google it or ask me here.