Topics

Exporting image files #HowTo #dxf


Tony Scott <tonyandlynne@...>
 

I have been using XTrackCAD 4.2.3a for years and been very happy with it, except for one thing. I have never been able to export a layout plan to be used by a program such as Corel PaintShop Pro. I have tried Files>Export but can only get an enormous BitMap file which looks a bit rough in PaintShop. The other export options are greyed out (why?). I have just downloaded v5.1.2a but it seems to be the same. Is there any way of getting a high quality image file from XTrack?
Cheers
Tony


c.prettyman@...
 

At least for DXF export, it only exports what you have selected - and if nothing is selected, the option is greeted out - so try selecting everything, and see what your options are. 

DXF is a vector format. I don’t know Corel, but if it imports DXF that should let you control the resolution when you rasterize it. 


Adam Richards
 
Edited

The bitmap size you get depends on the screen area and resolution since it is effectively a "dump" of the graphics in memory.  The image will normally be OK at the original size, but bitmaps do not scale up well beyond a low number of %. As they scale down important details can easily get lost. Therefore it is important to ensure the output size you want is as close as possible to the size you will use.  If necessary this means multiple exports and then stitching à la una panorama. :) 

DXF is the export vector format supported.  Vectors scale better.  Typically that output can be used by CAD programs like TurboCAD or Sketchup (free). Every selected visible line when you export in the layout is a DXF object - so things like whether sleepers are shown make a difference to the complexity of the output. Before V5.2, every sleeper is 4 DXF objects.  Note this is a 2D output - elevation is not included. 

Another approach is print to PDF.  PDF is at a fixed scale like a bitmap but has the lower file size of DXF because the lines and text are being exported as objects and not bits - some programs can cope with that as input and edit it, notably Illustrator can use a PDF variant as their storage type, so they can import it, edit it and then export as a bitmap rescaled as you wish. If you do this, you would set the PDF "printer paper size" as large as you can and also you can set the resolution up to 600 lpi or more. 

Oh, and yes, you need to select everything you want included first for DXF. 

Hope that helps,
Adam


Jonas Grumby
 

On Fri, Jan 17, 2020 at 07:02 AM, Adam Richards wrote:
print to PDF
How do you print to PDF? I don't see any option for that and there is no mention of it in the help file.


Adam Richards
 

It is Operating System dependent. To XTrackCAD you are simply Printing. 

In many OSes, you can then have a "PDF Printer" that creates a PDF file rather than putting ink on paper - it is installed as a printer driver. 

On Macs at least and possibly Linux, this option is built-in as a printer called "Print to File".  Output Format: PDF - the other options are PostScript or SVG.  I assume SVG may be useful as well (v means vector) - although I have never used that myself.

Adam


Jonas Grumby
 

Ok thanks. It seems like it's not operating system dependent. You just need a print driver for it, like the Adobe PDF Printer.

https://acrobat.adobe.com/us/en/acrobat/how-to/print-to-pdf.html

Some programs (like Quicken) have their own PDF print driver built in.


Russ Bonny
 

This has always been a tricky and frustrating feature of XTrackCAD. Saving to PDF only helps if the application you want to do more editing in can open PDF files. My preference for this type of work is GIMP - it's does 90% of what Photoshop can and it's free.

There is always a way to get the output you expect with Export to Bitmap, but it takes a lot of trial and error manipulation of the output file dpi and some settings in Options > Display and Options > Preferences > Min. Grid Spacing. There is no documentary guidance, so all you can do is tweak settings, export, repeat until you get the result you want.

I do export one layer at a time, so they can be edited manipulated independently in the editing software.


emrldsky
 

Id on windows, install the "Bullzip Printer". It works quite well and offers a bunch of printing options. It does go to a file.


Peace,

Mike G.

On 1/17/2020 8:47 AM, Adam Richards wrote:
It is Operating System dependent. To XTrackCAD you are simply Printing. 

In many OSes, you can then have a "PDF Printer" that creates a PDF file rather than putting ink on paper - it is installed as a printer driver. 

On Macs at least and possibly Linux, this option is built-in as a printer called "Print to File".  Output Format: PDF - the other options are PostScript or SVG.  I assume SVG may be useful as well (v means vector) - although I have never used that myself.

Adam


Adam Richards
 

If GIMP is your choice of editor, it can import SVG - so that might be a way instead of PDF.  https://docs.gimp.org/2.10/en/gimp-using-paths-and-svg.html

Adam


Martin Fischer
 

On Windows 10 I have a "Microsoft Print to PDF" printer that should work without installing any additional software.

Regards
Martin

Am 17.01.2020 um 18:15 schrieb emrldsky:

Id on windows, install the "Bullzip Printer". It works quite well and offers a bunch of printing options. It does go to a file.
Peace,
Mike G.


Tony Scott <tonyandlynne@...>
 

Thank you to all those who responded. I tried all the possible outputs and found that .xti, .dxf and .prn files are unable to be read by PaintShop. The Windows 10 'MS Print to PDF' produces a file that can be read but it is extremely rough with low resolution and more or less useless. The only option seems to be a BMP file which, apart from being very large, looks very disjointed at ordinary screen resolution viewing - it has to be zoomed way up to get a good image but then you can only see a very small portion of the plan on the screen. All a bit frustrating really.

Cheers
Tony


Adam Richards
 

The issue of the quality of PDF depends on the resolution of the virtual printer. I am not sure about Windows built in capabilities but I read there may be “quality” settings as well as custom size settings available.

Certainly there are third-party offerings with more control as well. On Mac setting to a very large paper size and having 600 dpi allows a high quality image.

i used this to produce banner prints of my 20ft by 12ft layout in two strips at half-size and then 2x the output for printing. So it can be done. Notably though, the standard size will only be like a sheet of normal paper which is much smaller than the screen and often a 300 dpi resolution.

Adam


 


Martin Fischer
 

Tony,

for an experiment I exported three layouts of different sizes to BMP. By using a DPI value of 25 I get good results in all cases. Maybe that helps you. I fnot I'd like to have your plan and an exported bitmap file for further experiments.

Regards
Martin

Am 19.01.2020 um 00:03 schrieb Tony Scott:

Thank you to all those who responded. I tried all the possible outputs and found that .xti, .dxf and .prn files are unable to be read by PaintShop. The Windows 10 'MS Print to PDF' produces a file that can be read but it is extremely rough with low resolution and more or less useless. The only option seems to be a BMP file which, apart from being very large, looks very disjointed at ordinary screen resolution viewing - it has to be zoomed way up to get a good image but then you can only see a very small portion of the plan on the screen. All a bit frustrating really.
Cheers
Tony


Tony Scott <tonyandlynne@...>
 

Martin

Thanks for your suggestion. However in the process of getting some files together to send to you I seem to have stumbled on a method of producing what I want - good quality images that are suitable for publication and/or can be manipulated in an image processing program (such as PaintShop or Photoshop). The process is:
* Use Export command to produce a BMP file.
* Open BMP file in PaintShop (or similar, I guess) - see attached file GW 25dpi screenshot 01.jpg (the actual BMP file is too large to send at 26.5 MB).
* In PaintShop save a copy (this automatically makes a JPG) - see GW 25dpi screenshot 02.jpg (actual JPG is 2.5 MB).

You can see how scratchy the BMP is. I made the copy just to try something different and couldn't believe the result. Tried it again and it worked again! I've no idea why a 2.5 MB JPG can be so much better than a 26.5 MB BMP. I had pretty well given up until receiving your message Martin, but as a result decided to give it one more try. I've been wanting to get this result for years. So thanks again.

Cheers
Tony





------ Original Message ------
From: "Martin Fischer" <Martinfischer8@...>
Sent: 19-Jan-20 9:20:34 PM
Subject: Re: [xtrackcad] Exporting image files #HowTo

Tony,
 
for an experiment I exported three layouts of different sizes to BMP. By using a DPI value of 25 I get good results in all cases. Maybe that helps you. If not I'd like to have your plan and an exported bitmap file for further experiments.
 
Regards
Martin
 
Am 19.01.2020 um 00:03 schrieb Tony Scott:
Thank you to all those who responded. I tried all the possible outputs and found that .xti, .dxf and .prn files are unable to be read by PaintShop. The Windows 10 'MS Print to PDF' produces a file that can be read but it is extremely rough with low resolution and more or less useless. The only option seems to be a BMP file which, apart from being very large, looks very disjointed at ordinary screen resolution viewing - it has to be zoomed way up to get a good image but then you can only see a very small portion of the plan on the screen. All a bit frustrating really.
 
Cheers
Tony
 
 
 
 
 
 
 


Alan Cox
 

it worked again! I've no idea why a 2.5 MB JPG can be so much better
than a 26.5 MB BMP.
BMP is a very old very simple file format that's a good 30 years old and
often not compressed at all. GIF would probably come out smaller still as
JPG is designed to compressed photographs with some fuzzing allowed while
GIF is designed to compress sharp bitmaps.

Alan


Adam Richards
 


Tony,
A BMP as I noted is a dump of bits (no compression). This means you have a large file with every pixels x color depth in it.  If you scale them they attempt to fill in the blanks by interpolation. That process necessarily smudges fine details because the edge is an edge but the scaling doesn't know that and produces either a fatter copy or a gradient depending on the contents of the two pixels. This is also true as the image scales down where the choice is what to make each output bit. Basically, unless you use the BMP at its original size the result will be poor. 

My apologies, I had assumed you knew that formats such as JPGs were designed to reduce the size of an image while preserving the detail by running a compression algorithm. The JPEG algorithm was originally created to compress huge images into a form that did not lose fidelity when scaled, in fact. I thought that would be the reason you were using GIMP!! 

One of the characteristics of JPG is to encode the edges since, in effect, the displayed image is always "scaled" to get back to the original. That makes a JPG better (although not perfect) at scaling especially down. The quality setting on the JPG export will enable you to balance file size versus scalability. More compression (lower quality) gives a smaller file but loses some detail - this means the result will be OK if scaled down from the original but may suffer as it scales up compared to high quality (less compression, bigger file).  In all cases of a layout, where there are comparatively large areas of single colors (including white) compression can be highly effective.

So overall, exporting a BMP as large as you can, and then encoding it as a JPG will result in a smaller but high quality file. 

We could add a JPG output option - at least in V6. GTK natively supports the output format, so once we are on a unified UI it will be simple to do. I have added it to the solution requests. 

Adam


Martin Fischer
 

Adam, 

without going into a deeper technical discussion: I think a lossless compressed format would be more suitable for XTrackCAD. So I‘d suggest PNG! 

Regards, 
Martin

Am 20.01.2020 um 16:45 schrieb Adam Richards <adamjmrichards@...>:


Tony,
A BMP as I noted is a dump of bits (no compression). This means you have a large file with every pixels x color depth in it.  If you scale them they attempt to fill in the blanks by interpolation. That process necessarily smudges fine details because the edge is an edge but the scaling doesn't know that and produces either a fatter copy or a gradient depending on the contents of the two pixels. This is also true as the image scales down where the choice is what to make each output bit. Basically, unless you use the BMP at its original size the result will be poor. 

My apologies, I had assumed you knew that formats such as JPGs were designed to reduce the size of an image while preserving the detail by running a compression algorithm. The JPEG algorithm was originally created to compress huge images into a form that did not lose fidelity when scaled, in fact. I thought that would be the reason you were using GIMP!! 

One of the characteristics of JPG is to encode the edges since, in effect, the displayed image is always "scaled" to get back to the original. That makes a JPG better (although not perfect) at scaling especially down. The quality setting on the JPG export will enable you to balance file size versus scalability. More compression (lower quality) gives a smaller file but loses some detail - this means the result will be OK if scaled down from the original but may suffer as it scales up compared to high quality (less compression, bigger file).  In all cases of a layout, where there are comparatively large areas of single colors (including white) compression can be highly effective.

So overall, exporting a BMP as large as you can, and then encoding it as a JPG will result in a smaller but high quality file. 

We could add a JPG output option - at least in V6. GTK natively supports the output format, so once we are on a unified UI it will be simple to do. I have added it to the solution requests. 

Adam


Robert Heller
 

At Mon, 20 Jan 2020 12:53:05 +0000 main@xtrackcad.groups.io wrote:


it worked again! I've no idea why a 2.5 MB JPG can be so much better
than a 26.5 MB BMP.
BMP is a very old very simple file format that's a good 30 years old and
often not compressed at all. GIF would probably come out smaller still as
JPG is designed to compressed photographs with some fuzzing allowed while
GIF is designed to compress sharp bitmaps.
JPEG is lossy compression -- it is meant for "natrual" images (eg photos),
since it compresses by deliberatly throwing data away. This is data that the
human mind re-creates based on inate knowledge of natural scenes. GIF is an
8-bit/pixel format, using color lookup tables and is fine when the number of
colors <= 256. For computer generated images with more than 256 colors, PNG is
probably the best format.


Alan



--
Robert Heller -- 978-544-6933 Cell: 413-658-7953
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@... -- Webhosting Services


Tony Scott <tonyandlynne@...>
 

Adam

A couple of things. I'm not using GIMP - not sure how that idea cropped up. Also, I know that JPGs reduce file size considerably. What I didn't know, because XTrack makes no mention of it, is that the exported BMP file has to be further processed - into a JPG or whatever. This is a real shortcoming and has frustrated me for years. It would be great if you could add a JPG (or whatever you think is the best file type) option to the Export command.

Cheers
Tony

------ Original Message ------
From: "Adam Richards" <@tynewydd>
To: main@xtrackcad.groups.io
Sent: 21-Jan-20 2:45:15 AM
Subject: Re: [xtrackcad] Exporting image files #HowTo


Tony,
A BMP as I noted is a dump of bits (no compression). This means you have a large file with every pixels x color depth in it. If you scale them they attempt to fill in the blanks by interpolation. That process necessarily smudges fine details because the edge is an edge but the scaling doesn't know that and produces either a fatter copy or a gradient depending on the contents of the two pixels. This is also true as the image scales down where the choice is what to make each output bit. Basically, unless you use the BMP at its original size the result will be poor.

My apologies, I had assumed you knew that formats such as JPGs were designed to reduce the size of an image while preserving the detail by running a compression algorithm. The JPEG algorithm was originally created to compress huge images into a form that did not lose fidelity when scaled, in fact. I thought that would be the reason you were using GIMP!!

One of the characteristics of JPG is to encode the edges since, in effect, the displayed image is always "scaled" to get back to the original. That makes a JPG better (although not perfect) at scaling especially down. The quality setting on the JPG export will enable you to balance file size versus scalability. More compression (lower quality) gives a smaller file but loses some detail - this means the result will be OK if scaled down from the original but may suffer as it scales up compared to high quality (less compression, bigger file). In all cases of a layout, where there are comparatively large areas of single colors (including white) compression can be highly effective.

So overall, exporting a BMP as large as you can, and then encoding it as a JPG will result in a smaller but high quality file.

We could add a JPG output option - at least in V6. GTK natively supports the output format, so once we are on a unified UI it will be simple to do. I have added it to the solution requests.

Adam


Michael Rozeboom
 

On 2020-01-20 12:37 p.m., Martin Fischer wrote:
Adam, 

without going into a deeper technical discussion: I think a lossless compressed format would be more suitable for XTrackCAD. So I‘d suggest PNG! 

I would agree with that, as PNG was designed for graphics, not photos.  Its purpose was to replace the patent encumbered GIF format.




Am 20.01.2020 um 16:45 schrieb Adam Richards <adamjmrichards@...>:


Tony,
A BMP as I noted is a dump of bits (no compression). This means you have a large file with every pixels x color depth in it.  If you scale them they attempt to fill in the blanks by interpolation. That process necessarily smudges fine details because the edge is an edge but the scaling doesn't know that and produces either a fatter copy or a gradient depending on the contents of the two pixels. This is also true as the image scales down where the choice is what to make each output bit. Basically, unless you use the BMP at its original size the result will be poor. 

My apologies, I had assumed you knew that formats such as JPGs were designed to reduce the size of an image while preserving the detail by running a compression algorithm. The JPEG algorithm was originally created to compress huge images into a form that did not lose fidelity when scaled, in fact. I thought that would be the reason you were using GIMP!! 

One of the characteristics of JPG is to encode the edges since, in effect, the displayed image is always "scaled" to get back to the original. That makes a JPG better (although not perfect) at scaling especially down. The quality setting on the JPG export will enable you to balance file size versus scalability. More compression (lower quality) gives a smaller file but loses some detail - this means the result will be OK if scaled down from the original but may suffer as it scales up compared to high quality (less compression, bigger file).  In all cases of a layout, where there are comparatively large areas of single colors (including white) compression can be highly effective.

So overall, exporting a BMP as large as you can, and then encoding it as a JPG will result in a smaller but high quality file. 

We could add a JPG output option - at least in V6. GTK natively supports the output format, so once we are on a unified UI it will be simple to do. I have added it to the solution requests. 

Adam


--




Michael Rozeboom


Team Amiga

DCC Wiki Admin