FineFindus / artem

Convert images from multiple formats (jpg, png, webp, etc…) to ASCII art, written in Rust
Mozilla Public License 2.0
293 stars 9 forks source link

Output squashed at certain output widths #19

Open gregorni opened 7 months ago

gregorni commented 7 months ago

I noticed this issue in Letterpress, where an image gets squashed vertically or horizontally when converting to ASCII. I couldn't really find a patter, different images seem to get squashed at different sizes.

Cube ![Cube](https://github.com/FineFindus/artem/assets/119804311/f1d7b37e-9fc0-4d8f-92f9-e178243131d5) I found this image gets especially squashed from the side at sizes above 200.
Phone ![2023-02-05-15-59-45-806](https://github.com/FineFindus/artem/assets/119804311/df047877-1c46-4e8d-b756-f3fb04a92f7a) I found this image gets squashed vertically at sizes below 100 and from 130-160, and squashed from the side at sizes above 170.
FineFindus commented 6 months ago

Could you please add an example of how to recreate the problem directly with artem, as well as run the command with --verbose trace and include its log output here.

gregorni commented 6 months ago

I ran it on the Cube image, here's the output.

``` gregorni@fedora /v/h/g/D/artem-v3.0.0-x86_64-unknown-linux-gnu> ./artem ~/Pictures/Cube.jpg --size=150 --verbose trace [TRACE] Started logger with trace [TRACE] Feature web_image: true [INFO ] Checking inputs [DEBUG] Input /home/gregorni/Pictures/Cube.jpg is a file [DEBUG] Using default characters [DEBUG] Characters used: 'MWNXK0Okxdolc:;,'... ' [TRACE] Using user input size as target size [DEBUG] Target Size: 150 [DEBUG] Scale: 0.42 [DEBUG] Invert is set to: false [DEBUG] BackgroundColor is set to: false [INFO ] Using colored ascii [INFO ] Using truecolor ascii [INFO ] Using border: false [DEBUG] Flipping X-Axis: false [DEBUG] Flipping Y-Axis: false [DEBUG] Centering X-Axis: false [DEBUG] Center Y-Axis: false [DEBUG] Outline: false [DEBUG] Target: Shell [INFO ] Opening image [DEBUG] Using inverted color: false [DEBUG] Input Image Width: 1920 [DEBUG] Input Image Height: 1219 [DEBUG] Columns: 150 [DEBUG] Rows: 43 [DEBUG] Tile Width: 12 [DEBUG] Tile Height: 28 [INFO ] Resizing image to fit new dimensions [DEBUG] Resized Image Width: 1800 [DEBUG] Resized Image Height: 1204 [TRACE] Created output string [TRACE] Calculating horizontal spacing [INFO ] Starting conversion to ascii [INFO ] Printing output :dOd. .:dOXNNNKd: .cx0XNNNNNNNXxdo, .cx0XXNNXK0kxNNNNkdddl. 'lx0XNXXXK0kdddolXNNNKdlddd:. 'lkKXXNXXKOkddddoc,. ONNNNxo;dxdo; ,okKXXXXXKOxddddl:,. oNNNNOd,;ddddl. ;okKXXXXK0Oxxddol:' .':NNNNKdl,d:odddc. ;oOKXXXXK0kxdddoc;. ..,;:clodxxxxdKNNNNxd,lc:odddo; ;dOKXXXXK0kxdddoolccloddxxxxxddddoooolONNNNOd::cc;oddddo' ,OXXXXX0Okxxxdloooodddddddoooooollc::;,'.;NNNNKdl:,lc;odddddc. :XXXOoloool:' ,odl:clollccccc:;,,''''.....KNNNNxd:':l:'loodddd: ;XXXO::cccc;. odd;,:;' 'cc;clllllllllllllONNNNOdc.'cl; ,ooooodo' 'XXXOlccoolclcxxo;'lc;,,cc',,''';:;;;;;;;;oNNNNKdl','lc;'ddlllodo .XXX0ll:doooldxxc;.llcclc'.:;..,,':::;,'.. XNNNNxd,'''lc;;dlxxkOd, XXXKll,'coodxkx;,.'cllc'..c:;,.',..';;;:::ONNNWOd;.'.;lc,,:dOO0kl XXXXol; ,xkkl;''cooc'.';:,...;'...';'.cdkNWWWXxl....:l:. ;0000d. KXXXol: 'kkk:;';odc',::,.;,,.'......;c;,cNWWWNxd... .cc;. k000xc 0XNNolc okOo;',ddc':llc:::::;;,'....,'',cXWWWWOx;....'c:,.cOO0Od. 0NNNdlc .kOO:,,ddl;;:c;cclllccc:;,.....',o0WWWWXxl.....;l:..kOO0x: OXNNxlc oOOd;;dddddddddddooooooollcc;,,,ldkWWWWWxd.....,dc. oOO0ko kNNNxll .kOOc:.cllccllloooooooooddddxxxxxxxxXWWWWOx:.. ..d:. ,O000d, xNNNklc.lO0x:, .cl:::ododxkkOOOOOOOkkkkk0KXNWWWWWXxdc. ..c;. k000kl xNNNklc.O00kkkkO00000000OOOkkxxxddxO0XNWWWWWWWWNXKkxxdc,.,; cO000d. xNNNOlco000OOOOkkkxxxddoooooldk0KNWWWWWWWWNXK0OOOOOOkxxdl;' O000xc dNNN0oc:looooollccc:;;,';ok0NWWWWWWWWNXK0OOOkxolxOOOOOkxddo, d000Od. oNNNKol; :lll;;, :ldk0XNNNWWWWNNXK0OOOkdlc;..;loodkOkkkkxddo; ,0000x: lNNNKol: 'cllldk0XNNNNNNWNXXK0OOOkdl:,.. ':c,.lddo:oxkkkkkxddd:lO00Oo :NNNXllc .cxKXNNNNNNNNXK0OOOOxdl:.. ,;...oo:.;oddd:;;dkkkkkxxddldO0d; ;NNNXxO0XNNNNNNNNXK0OOOkxoc;.... ..,cclc'. ldl';,cdddc;;ddkkkkkxxddokkl 'NNNNNNNNNNNXK0Okkkxoc;......,;:cllccclc:;;cdd;,. :xxdc;c;.:dkkkkkxdddd' .NNNNNNXK0Okkkdl:;,,'....,',;;:::cclooooooolddl'..'cxxxc;; ,xkkkkkxddl XXK0Okkkxol:,,. .cll::co,,kkc:.',,;:clooooooolxxxddxxxl;cxkOOOkkkkkkxd. .:oxkkkkxdoolllc;..:clc;:lodddddddxxxxxxxxxxxxxxxxxxxxxdck0000OOkkkxdoc. .:okkkkkxdollll::cc:cloooooooooooolllcccooddxxxxxkkO00OOkkxoc;' 'cdkkkkxdoolllcc;,cclc:,.. ':ldkOO000000OOOkkxol:' ,cdkkkkxdolllldxkxc:.;ldxOO000000OOOkkxol:,. .;ldkkkxdoollccdkkOOO000OOOkkxdl:,. .:oxkkxxdl:dkOOOOkkxdlc,. .:oxxxxxkxdlc;. 'cc;. gregorni@fedora /v/h/g/D/artem-v3.0.0-x86_64-unknown-linux-gnu> ```