Skip to content

u/noobshit

In this archive from May 2014 to Jun 2018

6
posts
31
comments
0
media
135
score

Yep, doing it manually works just fine.

I commented out these lines:

#nw="$((${w}*${mult}))"
#nh="$((${h}*${mult}))"

Then I replaced "${nw}x${nh}" with "$((${mult}*100))%" it this line:

 if ! convert "${_f}" -resize "$((${mult}*100))%" "${target}"; then

The script ran! Here's an output example:

Notice[picture_multiplier.sh]: Saving as: /home/david/Code/scientificaGLYPHS/bold_png/multiplier-output/U+03C4.png}/U+03C4.png
Notice[picture_multiplier.sh]: Converting /home/david/Code/scientificaGLYPHS/bold_png/U+2295.png from 5x5 to 0x0.
Notice[picture_multiplier.sh]: Saving as: /home/david/Code/scientificaGLYPHS/bold_png/multiplier-output/U+2295.png}/U+2295.png
Notice[picture_multiplier.sh]: Converting /home/david/Code/scientificaGLYPHS/bold_png/U+0173.png from 5x8 to 0x0.
Notice[picture_multiplier.sh]: Saving as: /home/david/Code/scientificaGLYPHS/bold_png/multiplier-output/U+0173.png}/U+0173.png
Notice[picture_multiplier.sh]: Converting /home/david/Code/scientificaGLYPHS/bold_png/U+010A.png from 4x9 to 0x0.
Notice[picture_multiplier.sh]: Saving as: /home/david/Code/scientificaGLYPHS/bold_png/multiplier-output/U+010A.png}/U+010A.png
Summary[picture_multiplier.sh]: Successful conversions: 974
Summary[picture_multiplier.sh]: Failed conversions: 1

I don't know which one failed, but anyway the images scaled 2 times instead of twenty-five (the first one is 1x1, makes it easy to control). Also, each png was output to it's own subfolder in the destination directory. I'm guessing that's to do with this:

target_dir="${dst}${_f/${src}/}}"
target="${target_dir}/${_f##*/}" 

But the real kicker is: it seems all I was missing was the % argument for mogrify -resize. I ran mogrify -resize 2500% *.png and checked the size of a few output glyphs. It seems to have worked well!

This was a big step forward, and your script helped me to understand how a lot of this works. It actually encouraged me to start something I've been pondering, which is to learn bash.

Thank you so much for all your time, really.

2 points

Ran into this:

sh picture_multiplier.sh ~/Code/scientificaGLYPHS/bold_png/ ~/Code/scientificaGLYPHS/bold_png/multiplier-output/                                                                                  
2
Notice[picture_multiplier.sh]: Source Dir: /home/david/Code/scientificaGLYPHS/bold_png
Notice[picture_multiplier.sh]: Dest Dir: /home/david/Code/scientificaGLYPHS/bold_png/multiplier-output
Notice[picture_multiplier.sh]: Multiplier: 2
Notice[picture_multiplier.sh]: Time to abort before execution: 5s
identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/512.
identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/512.
picture_multiplier.sh: line 88: *2: syntax error: operand expected (error token is "*2")    

The only thing I changed on the script was the shebang, to '/bin/sh', because I'm using zsh.

EDIT: This problem is not related to your script. It seems that the Imagemagick in the Arch repos doesn't come with the adequate libraries. I'll install imagemagick-full from the AUR and try again.

EDIT2: Nope, still:

identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/512.
identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/512.
picture_multiplier.sh: line 88: *2: syntax error: operand expected (error token is "*2"
2 points

But the docs keep restateing..

Resize will fit the image into the requested size. http://www.imagemagick.org/Usage/resize/#resize It does NOT fill, the requested box size.

As you can see a 64x64 square image was NOT produced by "-resize". In fact the images were only enlarged or reduced just enough so as to best fit into the given size.

So that Might be an issue.

Yup, and 250x250 assumes all images are the same size (well, that you want them to be the same size), and that's not the case.

This turned out more complicated than I thought.

1 points

I would figure out the command that resizes how you want

This is what I'm having trouble with, actually. I do not know how to express "multiply these images size by 25".

I didn't know about the 'find' method, I look into it as well.

Also, from what I read, it seems like the 'convert' option is no longer current, the ImageMagick documentation suggests 'mogrify'.

Thank you for your reply, I appreciate it.

1 points

Yes, I have the source files for the fonts that contain the glyphs, and I can export them in several formats. See the repo here.

Also, you can take a look at the issue that I linked to try and understand what we're doing (I really don't, I don't know anything about these things).

Basically creating a TrueType variant of a bitmap font, and then see if it works on Android.

Thank you for your attention!

1 points

All of these things sound great to me. I have some programming experience, so I get what you mean by 'learning through creation'. What I meant by learning with Arch is that other mainstream distros don't really throw much problems for you to fix manually these days.

If you truly do have to setup Arch your own way, then you're going to have your very own problems, and finally, your own solutions.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.