durdraw icon indicating copy to clipboard operation
durdraw copied to clipboard

Canvas shrinked after converting to ANSI

Open carbon-starlight opened this issue 1 year ago • 5 comments

I was working on a design concept on a 120 characters-wide canvas.

Screenshot from 2024-06-30 03-04-25

I decided to save the file in ANSI for better compatibility with other software.

I wasn't expecting it to overwrite the old file because of different extentions but it looks like they are the same type (binary).

When I open it that's what I see:

Screenshot from 2024-06-30 03-07-56

Opening with -W 120 doesn't help.

carbon-starlight avatar Jul 02 '24 19:07 carbon-starlight

Hi there. Sorry you're having this issue.

I wasn't expecting it to overwrite the old file because of different extentions but it looks like they are the same type (binary).

If you run "file filename.ans" and it says it's a gzip file, then it's a .dur file. If it says it's ASCII text with escape codes, it's an ANSI. Durdraw is currently a little dumb about the file extensions. It leaves it up to you to specify the extension when saving, or if you just press enter when saving a .dur, it will use the last filename without modifying the extension.

When loading files, durdraw ignores the filename extension and just tries to figure it out.

Opening with -W 120 doesn't help.

Please try the 0.28.0-BETA build from https://github.com/cmang/durdraw/tree/dev and pass --wrap 120 (or a larger number). This is a new option to help address this issue.

--wrap WRAP Number of columns to wrap lines at when loading ASCII and ANSI files (default 80)

I admit, the -W and -H is confusing when loading ANSIs that are wider than 80 columns, and don't have the dimensions specified in a SAUCE record. The automatic 80 column wrapping in the ANSI loader is in place for compatibility with classic DOS ANSI files. I am working on improving this situation.

Let me know if this helps. Thanks for the report!

cmang avatar Jul 02 '24 19:07 cmang

Also, I recommend making sure you have a .dur file saved as a master file format, and think of .ans as more of an export format. It's just a little safer that way, as the ANSI loader tries to account for a wide variety of "quirks" in different ANSI file formats, and (as you experienced) doesn't always succed 100%.

cmang avatar Jul 02 '24 19:07 cmang

Thanks, it works! Although the vertical size is now too huge

image image

BTW, are only 8 colors available for the background?

Edit: And is there a way to copy and paste text to another program?

carbon-starlight avatar Jul 03 '24 23:07 carbon-starlight

BTW, are only 8 colors available for the background?

For now.. that's the way most/traditional ANSI terminals worked until kind of recently. I'm working on bringing more BG colors to a future version. At least 16 colors (and iCE color file support) would be nice.

Edit: And is there a way to copy and paste text to another program?

I've been meaning to add a "Mouse On/Off" toggle in the settings, to make this easier. I'll work on this soon. Some terminals let you mouse select through a menu option.

As for the vertical size... it's certainly a bug in the ANSI loader. It's probably optimized a bit more for loading ANSI files made in other editors than loading its own exports, I'm afraid., as silly as that sounds.

Until it's fixed, if you want to work your .ANS file back and forth between Durdraw and another ANSI editor without the extra lines, here is a possible way to do it:

1: Save your ANSI file in Durdraw. 2: Load it into another editor that can save SAUCE records. 3: Save it as an ANSI file with with a SAUCE record, which should specify the width/height in the record. 4: When you load the ANS file back into durdraw, it should load it with the correct dimensions (without the need for --wrap).

cmang avatar Jul 04 '24 00:07 cmang

Edit: And is there a way to copy and paste text to another program?

For now, you can use the --nomouse option to disable the mouse on startup, and then copy text from durdraw.

cmang avatar Jul 04 '24 01:07 cmang

Going to close this issue as the original issue is resolved with --wrap, and the second issue is resolved with --nowrap.

The ANSI loader still gets the dimension wrong sometimes...

If you're going to edit and save, then re-load art in Durdraw, I recommend using the .dur file format.

cmang avatar Oct 24 '24 11:10 cmang