What happens when file.png and file.bmp are both present

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
hmotulsky
Posts: 33
Joined: Tue Oct 21, 2003 2:10 am
Contact:

What happens when file.png and file.bmp are both present

Unread post by hmotulsky »

I've been using H and M for over a decade, growing the same projects, so there is a lot of history in my files.

I just found out that the published html files in some cases show the wrong image. I finally figured it out. This happens when there are two distinct images, both used in the project, one in .png format and one in .bmp format. The .bmp image is used in both places, and the .png file is ignored (but shown in H and M, so the error isn't obvious when working).

I can fix this one example easily enough, now that I have discovered it. But there probably are many other places where this happens (my help projects have about a thousand images). How can I identify when a .png image file I specified to be used, and is shown in the H and M app, is actually ignored/substituted (with bmp) when published? Can this be fixed in H and M. Obviously, the image you see while working should match the image that people see when the project is published (to the web).

(No, I don't deliberately switch between file extensions. Both of these were created by copy/pasting and then accepting the default numbered file name suggested by H and M. But at some point a number of years ago, the default extension H and M suggested must have changed.)

Using H and M 7.09 (3792) on win 7.
Last edited by hmotulsky on Fri Feb 19, 2016 7:18 pm, edited 1 time in total.
Harvey Motulsky
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Re: What happens when file.png and file.bmp are present

Unread post by Simon Dismore »

I believe you are describing a situation where two different images 'filename.bmp' and 'filename.png' are both present in a single project. During compilation to WebHelp, 'filename.png' is copied to the output folder as is, after which 'filename.bmp' is converted to PNG. The converted file overwrites the other 'filename.png' so you can no longer see the difference in the documentation.

I could fix this using the following steps:
  1. I copied an uncompressed project (I chose the 'Feature Images' example)
  2. In H&M I duplicated a topic ('Featured images explained') containing a PNG image
  3. I used Photoshop to make a copy of the image ('hm-feature-image.png') overprinted with "BMP" which I saved as a BMP with the same filename ('hm-feature-image.bmp')
  4. In the duplicate topic I changed the image properties to point to the BMP instead of the PNG
  5. I saved and closed the project in H&M
  6. I used the Premium Pack Toolbox to do a simple replace of ".png" with ".truepng.png"
  7. I used a command window to rename files *.png to *.truepng.png
  8. I opened the project in H&M and recompiled to an empty HTML folder
    Success: the PNG image was not overwritten by the BMP. Each image was displayed in the correct location.
I hope this helps. By the way, I like your statistics guide a lot.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: What happens when file.png and file.bmp are present

Unread post by Tim Green »

Hi Harvey,

Simon's solution would work but it's probably more complicated than you will want for anything more than one or two images. The simplest solution is to always avoid duplicate file names, irrespective of the extension.

Basically, you just need to know that you must always avoid image files with duplicate names in Help & Manual projects, and that this also includes files with the same names and different extensions. For HTML output, BMP and other bitmaps need to be converted to HTML-compatible formats (GIF, PNG or JPG). So depending on your file names and conversion settings, a file called myfile.bmp will get converted to myfile.gif, myfile.png or myfile.jpg and overwrite any existing files with those names.

So again: the easiest approach is to simply assume that files with the same names will always cause conflicts in your output, irrespective of the extension. You can easily change the names of individual images in your project: Double-click on the image in the HM editor, select the image in the Open dialog and then use F2 to change its name on the disk before re-inserting it. Then select the new name and hit OK to update.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
hmotulsky
Posts: 33
Joined: Tue Oct 21, 2003 2:10 am
Contact:

Re: What happens when file.png and file.bmp are present

Unread post by hmotulsky »

But my projects have about a thousand images. How do I know when the image I see when I work in H and M is not what my users will see in the web version? Really, H and M ought to give a warning about this. It tries to be pretty close to a WYSIWYG editor, but in these cases what I see and what I get are very different! It also ought to warn when it chooses an image from a different folder than I specified, again resulting in a mismatch.

I'll go through manually and try to find the mismatches, but they are easy to miss.

And NO I did not choose to use the same name. H and M, over the years, did. I almost always pick the default numbered name H and M offers. But somewhere along the line, the default extension changed.
Harvey Motulsky
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Re: What happens when file.png and file.bmp are present

Unread post by Simon Dismore »

Tim Green wrote:Simon's solution [is] probably more complicated than you will want
Bear in mind that I included optional steps to prove that my method would work. Dr. Motulsky would require at most:
  1. Copy the project folders for safety
  2. Use the Premium Pack Toolbox to do a simple replace of ".png" with ".truepng.png"
    Open the project in the Toolbox
    Navigate Tools > Complex Find & Replace in Topics > Simple Search
    Note: don't include the quotes; do use lower-case: the toolbox is case-sensitive, anyway you don't want to change the upper-case string .PNG in the Prism User Guide
  3. Use a command window to rename files *.png to *.truepng.png
    Open a command window
    Navigate to the folder containing the images
    At the command prompt, type "dir" to check you're in the right place
    At the command prompt, type "rename *.png *.truepng.png" without the quotes
    At the command prompt, type "dir" to check that the renaming worked OK
  4. Open the project in H&M and recompile to an empty HTML folder
If the alternative is manually determining which PNG files from GraphPad's 1,000+ screenshots share the same names as the BMP files, and then renaming every one through the H&M File Properties dialog, I expect automation will be faster and less error-prone.
hmotulsky
Posts: 33
Joined: Tue Oct 21, 2003 2:10 am
Contact:

Re: What happens when file.png and file.bmp are both present

Unread post by hmotulsky »

Thanks Simon, your suggestion makes a lot of sense.
Harvey
Harvey Motulsky
hmotulsky
Posts: 33
Joined: Tue Oct 21, 2003 2:10 am
Contact:

Re: What happens when file.png and file.bmp are both present

Unread post by hmotulsky »

In case anyone else has this issue, here is how I solved it. The trick was to find the duplicated (or near duplicated) files. The application DupeGuru ( https://www.hardcoded.net/dupeguru/) can be configured to only look for duplicate file names (and ignore contents) and can be told to ignore differences in extensions. This made it easy to find the near duplicates -- even if in different folders, and even if one is .png and the other .bmp. Then I just manually renamed one of each duplicated pair. Here is a screenshot of DupeGuru's preference page:
http://screencast.com/t/qGdlkPybE
Harvey Motulsky
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: What happens when file.png and file.bmp are both present

Unread post by Tim Green »

Hi Harvey,

Thanks for the tip on DupeGuru. I just tried it out myself and it looks like a useful tool for this. :)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Toni Weller
Posts: 2
Joined: Mon Mar 13, 2017 4:22 pm

Re: What happens when file.png and file.bmp are both present

Unread post by Toni Weller »

I can advise a couple powerful free alternatives of Duplicate Finders. Check out https://itunes.apple.com/us/app/dolly-l ... 1060955380 or https://www.cleverfiles.com/duplicate-f ... mover.html
Post Reply