Skip to content

Save as: use extension #472

Closed
Closed

Description

@hi5

Is this feature request related to a problem?

When you use save as, and enter say "myfile.jpg" as filename, it should actually use the format of the extension, now it uses the format chosen (whatever happens to be the default) so I have a PNG, do Save as "myfile.jpg" hit enter, and then the PNG preferences appear instead of the JPG preferences.

Describe the best way to implement this.

If an extension is present in the File name field, use that format, this is common in many programs.

Thank you!

No credits :)

Activity

  1. ZPNRG commented on Mar 16, 2023

    @ZPNRG

    I tend to agree with this request. If I just enter "myfile" and the format in the drop-down menu selected is set (whether by default or manually changed) to PNG, then PhotoDemon should save the file as myfile.png. However, if I make a point to enter the name as "myfile.jpg", then it would be nice if PhotoDemon was smart enough to save the file as a JPG/JPEG file. Granted, if I haven't made any changed to the JPEG preferences, then PhotoDemon is going to save the file with the default JPEG preferences.

    I don't remember if PhotoDemon has any setting to use the last used format preferences while the app has been running, which might override the default format preferences.

    The one slight issue here would be you manually selected a format you wanted, but pasted a file name to use that had .EXT that you didn't catch (notice) and that is different. You manually selected the format you wanted, but the filename extension indicates a different format. In this example, you actually want the format you manually selected.

    Maybe the best approach would be to offer an override option/setting where PhotoDemon will always use the filename extension format instead of the selected format, if the filename includes a valid extension that PhotoDemon can save as.

  2. wqweto commented on Mar 16, 2023

    @wqweto
    Contributor

    Start WinWord, type something, press Ctrl+S, enter myfile.doc and notice you get your file saved as myfile.doc.docx. The output format is not changed because of the .doc suffix and this is standard behavior IMO, not silently saving my PNG files in JPG format.

  3. hi5 commented on Mar 16, 2023

    @hi5
    Author

    @wqweto I'm afraid that is not correct, try it with wordpad for example, save as "file.txt" note that the filetype can stay on "RTF" (the default), hit save, now wordpad will warn you that it is saving it as text format and save "file.txt", not "file.txt.rft" and the file is actually a txt file (not a rtf) - this happens in many other programs too (otherwise I wouldn't be aware of such a "feature" and it something I miss). (and who would want to save a PNG file as "file.jpg.png" - that is just too odd.

  4. wqweto commented on Mar 17, 2023

    @wqweto
    Contributor

    @hi5 It's true that this use-case is custom handled in Office's save dialogs but the behavior is well thought out IMO. I'm myself emulating this behavior in my applications in standard save dialogs too.

    Let me summarize: The goal is not to save PNG images with .jpg extension because the world is already full of images with mismatched file extensions.

    There are different approaches to tackle this, silently saving as JPG with default settings is the least convenient (the most surprising) for the end user. Appending image type suffix if currently entered filename's extension differs from standard image type suffix, is another simple approach that is introduced by Office application so some users are aware of it and in principle this cannot be too bad to emulate.

  5. manfromarce commented on Mar 17, 2023

    @manfromarce
    Contributor

    It could have a new filter All supported files (*.jpg; *.png; ...) selected by default, like in the Open dialog. This way it keeps the user-specified extension if supported, or appends the first one if the user doesn't enter any.

  6. tannerhelland commented on Aug 15, 2023

    @tannerhelland
    Owner

    Hello friends. Thank you to everyone for their thoughtful discussion on this topic. I apologize that it has taken me so long to respond.

    I've just uploaded a new nightly build that implements this behavior. The relevant commit (ff684a1) describes things in more detail. Basically, a manually entered file extension is only used IF the user doesn't change the Save As dialog's file format dropdown. (If the dropdown is used, it is always given precedence in determining file format.)

    There are a number of other caveats that have to be caught to ensure predictable behavior, and if a manually entered file extension is used to determine the target image format, a format options dialog will always be raised as an extra safeguard against unexpected behavior. (e.g. if an image is named image.jpg and you re-type this as image.png in the File > Save As dialog, a PNG export options window will always appear to confirm the behavior)

    Because saving files is such a critical operation, I want to be certain nothing was overlooked. I will leave this issue open for a few days so I can triple-check everything against other common software's behavior. If you manually type out file extensions and this feature is useful to you, please give the latest nightly build a try and let me know if PhotoDemon now behaves how you expect it to.

    Thank you again 🙏

  7. hi5 commented on Aug 16, 2023

    @hi5
    Author

    Just tested it out and works for me, going to save me time - many thanks!

  8. tannerhelland commented on Sep 27, 2023

    @tannerhelland
    Owner

    Thank you for testing this, @hi5 ! I will mark this issue as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions