null54 Posted August 25, 2023 Share Posted August 25, 2023 I am working on converting my Optimized JPEG FileType to PDN 5. I was hoping to be able to use the built-in JPEG FileType for saving, but I could not see any was to programmatically configure its quality setting. Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint Shop Pro Filetype | RAW Filetype | WebP Filetype The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait Link to comment Share on other sites More sharing options...
Rick Brewster Posted August 25, 2023 Share Posted August 25, 2023 There isn't really any publicly accessible way to use the built-in FileTypes for saving. I'm guessing you want to use the built-in JPEG FileType because it knows how to deal with WIC and all of its sharp corners. I'm planning a big revamp of File Types stuff in PDN 6.0, but that's still quite a ways off. In the meantime I'm extremely hesitant to add pretty much anything to the FileType class, because part of the revamping will be replacing it with an interface-based API. However, instead of general purpose APIs (e.g. FileType), it might be reasonable to put in a special purpose interface for this sort of thing, e.g. public interface IJpegService { IJpegSaveOptions CreateSaveOptions(); void Save( Stream output, IBitmapSource bitmap, IJpegSaveOptions options, CancellationToken cancelToken); } public interface IJpegSaveOptions { int Quality { get; set; } ... ... some properties for metadata, color context, etc. } This is doable now, and also provides an interface that is supportable after the FileTypes revamp, even if it does essentially get superceded by some kind of general purpose API. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
null54 Posted August 25, 2023 Author Share Posted August 25, 2023 4 minutes ago, Rick Brewster said: I'm guessing you want to use the built-in JPEG FileType because it knows how to deal with WIC and all of its sharp corners. That is correct. Mainly for the fact that it handles all of the metadata support, which would be a pain to re-implement using WIC. I considered casting the token returned by CreateDefaultSaveConfigToken to PropertyBasedSaveConfigToken, but that is a bit of a hack. 19 minutes ago, Rick Brewster said: However, instead of general purpose APIs (e.g. FileType), it might be reasonable to put in a special purpose interface for this sort of thing, e.g. That would work. Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint Shop Pro Filetype | RAW Filetype | WebP Filetype The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.