graphics quality in HTML output

Discuss the word processor
Post Reply
raziv
Posts: 5
Joined: Wed Jan 09, 2008 7:36 pm

graphics quality in HTML output

Post by raziv »

Hi all,
When I save an .odt document as HTML (through the "save as" option), the graphics in my file are converted to gif images of low quality - much lower than the originals. Is there any way to control the quality of graphics in documents saved as HTML? I'd prefer retaining the same graphics quality.
Thanks,
Raziv
User avatar
foxcole
Volunteer
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: graphics quality in HTML output

Post by foxcole »

raziv wrote:When I save an .odt document as HTML (through the "save as" option), the graphics in my file are converted to gif images of low quality - much lower than the originals. Is there any way to control the quality of graphics in documents saved as HTML? I'd prefer retaining the same graphics quality.
Please see the Survival Guide to the forum. (There's a link to it in my sig line below.)

You've only provided half the necessary details. What format and resolution are the original images? What program created the image files? Why are you using Writer to create HTML?

I guess I should have asked that last question first. ;)
Word processors generate very poor HTML.... waaaaay too much bloat and too many other problems. I recommend KompoZer which gives you both a very nice WYSIWYG editor (which is what post people want when they're trying to use a word processor for the job) but it also has an HTML editor and tag view. It's also open source. I run the portable version:
http://portableapps.com/news/2007-12-05 ... revision_2
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: graphics quality in HTML output

Post by acknak »

I'm afraid Fox is right: if you care about such details, you don't want to use OOo to make your HTML. Writer (export by Save As) is designed for print work, and it always scales the images to fit on the paper page. There is no way to tell writer not to scale the image, even though the original image is stored perfectly intact in the document.

Using Writer/Web (File > New > Web Page) also seems to scale images, although for what reason I don't know.

PS: Hmm, I think I have to take some of that back. I just tried it again with a few different images, and it seems that most of the time, if you change the image size in Writer to "Original Size", then when you Save As HTML, the image is exported with no scaling. However, some images seem to be always scaled; why, again I don't know.
AOO4/LO5 • Linux • Fedora 23
raziv
Posts: 5
Joined: Wed Jan 09, 2008 7:36 pm

Re: graphics quality in HTML output

Post by raziv »

Thanks for the replies!

I just now see I haven't really specified what I ment by "low quality"... I meant lower resolution...

But let me start from the beginning...
The task is a fundamental one: write a document as .odt (on ubuntu Dapper ooo2), and export it as .doc, to be read and edited on a windows machine by another person. When simply exporting as .doc, the images come out in the wrong place in the document - out of page, over text - a real mess - I wouldn't even know where to start describing the effect let alone try solving it. After searching for a working "common language" - it turns out that .html maintains the structure of the document perfectly. The only bad thing is the images, exported out of the document to separate files, are saved in a very low resolution, and not their original one. The temporary solution for me is handing in two files: .pdf (for high-resolution graphics) and .html (for editing and handing back).

foxcole,
Original images are of .png format, created through wine running some w32 app, and afterwards cropped off in gimp and saved again. They are then pasted into the .odt. As an example, one of the images was originally 1625x1232, and it was exported during the "save as html" stage as a 587x509 .gif, rendering most of the details in it unreadable.
All the images in the .odt file are encapsulated in their own frame, containing the caption too:

text text text text
text text text text
----------------------- (frame start, anchored as character)
(.png image, anchored as character)
caption
----------------------- (frame end)
text text text text

Raziv
User avatar
foxcole
Volunteer
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: graphics quality in HTML output

Post by foxcole »

raziv wrote:When simply exporting as .doc, the images come out in the wrong place in the document - out of page, over text - a real mess - I wouldn't even know where to start describing the effect let alone try solving it.
Can you perhaps post examples? Even just screenshots if needed, but a sample .odt file would be very helpful.

The other critical detail is what version of Word is being used to open the files, and what specific version of Word are you saving as? Word isn't compatible with itself across versions, but you'll have the best results saving as Word 97/2000/XP. That's the most compatible format among all the Word versions, and the best format to share between Writer and Word. Is that the format you're using? If you're saving as Word 2003 XML, a Java conversion layer in there might be affecting the Word format. (I can't get mine to save a valid XML file that either Word or the browser can view, even as source code. But I'm using an older JRE; I've just been too lazy to update it on my flash drive.)
raziv wrote:Original images are of .png format, created through wine running some w32 app, and afterwards cropped off in gimp and saved again. They are then pasted into the .odt. As an example, one of the images was originally 1625x1232, and it was exported during the "save as html" stage as a 587x509 .gif
1625x1232? Good lord, that's huge! But I can see why, if it's being reduced to 587x509, the quality would be completely unacceptable.

No matter what happens, though, you should reduce the original image file size, even if you have only one picture per document. (You cropped it in GIMP and it's still that big?) Unless your document page size is enormous, there's no way either Writer or Word could display all that data, and the file size would be, for most users or publishers, unnecessarily and unacceptably bloated. The first thing to do is try a different file format, before going into any resampling experiments.
raziv wrote:text text text text
text text text text
----------------------- (frame start, anchored as character)
(.png image, anchored as character)
caption
----------------------- (frame end)
text text text text
Anchored as character should be just fine; it's an anchor Word understands (at least, Word 2000 and 2003 do). I have no trouble whatsoever converting ODT files with images anchored as character, but I'm also not using images that large. I wonder if it's confusing the conversion filter.

So again, a sample would be most helpful if you could possibly share one.
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
raziv
Posts: 5
Joined: Wed Jan 09, 2008 7:36 pm

Re: graphics quality in HTML output

Post by raziv »

I've tried reducing the size of images in a shortened version of my document. Then I saved it as .doc. The image-containing frames are not exported correctly.
In both Word 2002 sp3 on XP and on Vista (couldn't find out the office version - what a mess microsoft did there - but it was some new version - with the interface totally alien):
1. The frame itself: instead of being anchored "as character", is anchored "in front of text", and
2. The text inside the frames (comprised of the image, anchored as character and the caption) is left-aligned instead of centered.
I attach an example .odt, (I would have included the "saved-as" .doc version, but it's too big - five times the size of the .odt version - so you'd have to do the "save-as" yourself and we'll see if you get the same results).

It seems I have another problem that would have to be overcome: the font in the equations - in Word almost all the characters come up as squares and such garbage...

Raziv
Attachments
offending.odt
(48.71 KiB) Downloaded 289 times
User avatar
Cambirder
Volunteer
Posts: 647
Joined: Thu Nov 22, 2007 1:01 am

Re: graphics quality in HTML output

Post by Cambirder »

I just saved the file as .doc (Word 97/2000/XP), and have managed to open it in Word Viewer 2003, without any problem.


As for the font problem, you seem to be using Nimbus Roman No9 L, sounds like you friend's PC does not have this font installed.

Its always best to re-size imaged before adding to a document as you can maintain IQ far better in a graphics package than letting Word or Writer do it.

Re-size the image in Gimp, then add a touch of sharpening.
All the images in the .odt file are encapsulated in their own frame, containing the caption too:
Are you sure? all those pics on the last page seem to be in a table.
OOo 3.3 on Windows 7 & 3.2.1 on Mint 10
raziv
Posts: 5
Joined: Wed Jan 09, 2008 7:36 pm

Re: graphics quality in HTML output

Post by raziv »

Cambirder, about the images in a table - well, yeah, you're right there... but it's not the rule. All the rest of the images are as per the first image - encapsulated with their caption in a frame (believe me, I have tons of them...). The table (itself in a frame, with caption) is a one-timer (as for this stage of work, at least...).
About Word Viewer, the goal is to edit the .doc and send it back edited, so Word Viewer is insufficient. It's not surprising, however, that different products open a .doc file differently - at work we have all the same version of Word, all have windows XP, and yet .doc files have a tendency not to look the same on different computers, so we have a "publishing" computer that is the last station every .doc has to pass before leaving the group to the "outer world" - so much wasted time...
Raziv
User avatar
foxcole
Volunteer
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: graphics quality in HTML output

Post by foxcole »

raziv wrote:In both Word 2002 sp3 on XP and on Vista (couldn't find out the office version - what a mess microsoft did there - but it was some new version - with the interface totally alien):
That would be the infamous Word 2007, about which most people seem to share your reaction.

I tested with the developer snapshot of OOo 2.4 and the OOo portable 2.3.1. I got the same results with each, outlined below.
raziv wrote:1. The frame itself: instead of being anchored "as character", is anchored "in front of text", and
Not in the .doc files I saved from that odt. I have Word 2003, though, not the unpopular 2002. All pictures are inline in the .doc version, the way I believe you're expecting them to be, so I can't reproduce that particular problem.

I remember older versions of OOo being confused by image borders that overlapped table borders, and if you look closely at the table images, those do. I realize you're saying this isn't the normal document content your shop typically works with, but that might be contributing to the problem you're having.

Am I missing something? I'm not seeing where you told us what OOo version you're using. That's the most critical detail of all!
raziv wrote:2. The text inside the frames (comprised of the image, anchored as character and the caption) is left-aligned instead of centered.
You're right, apparently Word can't convert styles inside captioned image frames.

Oddly, I can open the Word version in Writer, select the image and the caption and change their alignment to centered, then re-save. That fixes the alignment of those items when the document is opened in Writer and Word, so this might need to be an added step after the first .doc conversion, before the .doc file is sent out.

But all the other formatting aside from those discussed below appear to be just fine in Word 2003 in my tests. I can't reproduce your problem with the other images.
raziv wrote:It seems I have another problem that would have to be overcome: the font in the equations - in Word almost all the characters come up as squares and such garbage...
I agree with Cambirder. The Nimbus Roman No9 L font apparently isn't close enough to existing font definitions on the receiving computer... certainly true for my WinXP system... so no substitution is possible. I did a little research and discovered it's based on Time Roman, which most Windows systems don't have but the OS I think is given the ability to substitute Times New Roman for it without having to run through the font comparisons etc. Does Times Roman have the characters you need? Times New Roman in Word appears to be fully equipped, so if you can get a font that translates well to Times New Roman the document should be okay. Too bad about the Nimbus font; it's a good-looking one.
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
huw
Volunteer
Posts: 417
Joined: Wed Nov 21, 2007 1:57 pm

Re: graphics quality in HTML output

Post by huw »

acknak wrote:I'm afraid Fox is right: if you care about such details, you don't want to use OOo to make your HTML. Writer (export by Save As) is designed for print work, and it always scales the images to fit on the paper page. There is no way to tell writer not to scale the image, even though the original image is stored perfectly intact in the document.

Using Writer/Web (File > New > Web Page) also seems to scale images, although for what reason I don't know.

PS: Hmm, I think I have to take some of that back. I just tried it again with a few different images, and it seems that most of the time, if you change the image size in Writer to "Original Size", then when you Save As HTML, the image is exported with no scaling. However, some images seem to be always scaled; why, again I don't know.
Which images always seem to be scaled?
raziv
Posts: 5
Joined: Wed Jan 09, 2008 7:36 pm

Re: graphics quality in HTML output

Post by raziv »

It's bad news indeed that the problem is not reproducible... Unfortunately, the solution of manually fixing each image in the .doc file will take too much time and is not practical for the long run...
I'm afraid that as for the images alignment problem I'll have to stick to the common .html format that I can count on to retain the structure of the document, if not its quality (in terms of image resolution). For reviewing the images in my document, I'll have to attach also a .pdf version - that's just a few clicks- on my part, and just the hassle of browsing the .pdf for the images- on the receiving end (which I have no problem in inflicting if someone is stubborn about using only Word...).
About the equations' font - I'll see then if i can get the receiving part to install the nimbus font before I start reformatting all the equations in my document.

Thanks so very much for all the advice!
Raziv
Post Reply