Krita: Multi-target Exporter
OpenPublic

Mock History

Current Revision

Mock Description

[Note: I know the main focus of the team right now is on bugfixing and polishing Krita, and I don't want to distract from that, but this is meant to be a more of a long-term idea and discussion.]

This is a rough initial concept proposal for an advanced, "Multi-target Exporter" feature for Krita.


Motivation.

As of Krita 4.1, the export functionality is limited to exporting your entire, flattened artwork as a single file, with a single format, at the original size. As such, it functions much in the same way as the "save as" dialog, with the extra convenience of allowing you to export as a different file format while saving your project as a Krita document.

This new Multi-target Exporter exporter is designed to expand upon (and ultimately replace) the classic exporter by adding support for exporting multiple Export Targets.


Defining an "Export Target".

At the core of the Multi-target Exporter is a set of individual Export Targets. Each Export Target represents an individual export configuration, with a variety of options, such as:

  • Path: Where this export target will export to, with special macros like $HOME (user's home or mydocuments folder) and $DOCUMENT (the same directory as the current .kra Krita document). A button next to this field will open the file browser, allowing the user to select the directory.
  • Format: The file format that this export target will export as. A button next to this field will open a format-specific settings dialog. (Not shown in the original mock-up image)
  • Source: This option allows the user to control exactly what is exported by this particular export target. By specifying a layer or group name, the user can export only the contents of a specific layer or group, for example. By using consistent naming conventions the user can even export multiple images with a single target (i.e. using "Sketch" to export multiple different images for each layer that's named "Sketch"). By leaving the source field blank or using a macro such as $MASTER or $MERGED, the entire image will be exported.
  • Scale: These options allow the user to export their artwork at a different size than their document for each export target. "Auto" filtering would automatically pick a well-suited filtering algorithm depending on whether the user is enlarging or reducing their image.

Note: Of course, it could/should be possible to add even more per-target export options, like enabling/disabling certain channels, cropping, changing color spaces, saving animation frames out as individual images or a sheet. 'swizzling' or weaving multiple grayscale images into each channel of a single image (a common compression strategy for things like game art assets), etc.


What does this amount to?

The strength of such a system is the ability to set up multiple Export Targets within your Krita Document, allowing you to set up export schemes that are as simple or as complex as the your workflow demands. For example:

  • A digital painter may want to work at a very high resolution and export their entire painting at multiple sizes (100%, 50%, 25%, etc.)
  • A web developer may want to export their project as multiple file formats, including different kinds of raster and vector formats.
  • An illustrator or animator may want to be able to export their lines or background as a separate image while also exporting their finished work.
  • A game developer may want to manage multiple texture maps (color, roughness, metalness, normal, etc.) for a given asset as different groups within a single Krita Document and export them all at the same time.

These are just a few examples off the top of my head, but a system in which users can set up their own export targets would give them a lot of flexibility and power to do almost anything. What's more, creating presets for export targets (which could possibly be shared between users as a resource) would make it quick and easy to set up even complex export schemes.

emmetoneill created Krita: Multi-target Exporter.Sep 30 2018, 10:24 PM
emmetoneill added a project: Krita: Abyss.
emmetoneill added subscribers: rempt, eoinoneill.
rempt added a comment.Oct 1 2018, 8:21 AM

This sounds like something we explicitly designed the Python api for, btw.

hi Emmet,

I could see it being possible that someone would want something like this on occasion.

From a UI standpoint, my main concern is that 90% of the people that use export want it the way it works now. They just want to simply output the file to a different format. People should only see these options if they are choosing to export something out in multiple formats. We would also have to decide if these settings would be saved to the KRA file. If I have a file with a configuration of export options, I would expect them to be remembered if I closed the document and re-open it later.

One way to do this UI would be to hide all your new stuff at first, and add a checkbox like "export multiple times". If that is checked, your other options can show up and people can continue configuring things.

I think showing all of these options by default is going to be confusing for most people, but it could be nice if people enable it for added functionality.

@rempt has a good point though about usage and it being too niche to be included by default (better as Python). I wonder if this is going to satisfy what people want, or if they want other types of functionality when exporting multiple times. For example I have heard people that want to export out certain layers when they export, certain groups of layers.

Is there any existing tickets in the bug tracker for people requesting stuff like this? Maybe we can see if we can tie some existing bugs and wish list items to this discussion.

This is an interesting idea and something I hear about on occasion from people. It could be neat for certain workflows.

emmetoneill added a comment.EditedOct 1 2018, 11:45 PM

From a UI standpoint, my main concern is that 90% of the people that use export want it the way it works now. They just want to simply output the file to a different format.

Ok. I'll take your word for it. Although the old cliche that's often [a bit dubiously] attributed to Henry Ford comes to mind, "if I had asked my customers what they wanted they would have said a faster horse." Similarly, I think that good and confident design is internal, and comes from taking a lot at what's there and thinking about how it can be made better. Otherwise you end up waiting for users to ask you for something, or worse, reacting to ideas in other, sometimes competing programs. Anyway...

People should only see these options if they are choosing to export something out in multiple formats.

I think the idea of a default export target handles that relatively well. When you open the exporter the first time, you'll see a default export target that's saves next to your Krita document, as a PNG (or whatever default format), sourcing the merged image, at 100% document size.

You open it, maybe change the name or format, and hit export. Which ends up being essentially the same amount of effort that's required using the current export functionality, i'd argue.

We would also have to decide if these settings would be saved to the KRA file. If I have a file with a configuration of export options, I would expect them to be remembered if I closed the document and re-open it later.

Yeah. I agree. That should be the case, for sure.

One way to do this UI would be to hide all your new stuff at first, and add a checkbox like "export multiple times". If that is checked, your other options can show up and people can continue configuring things.

Yeah, maybe. Would that checkbox exist inside the current exporter (which seems to be little more than basic QT file browser right now)? Checking it would then open another window?

@rempt has a good point though about usage and it being too niche to be included by default (better as Python).

Whether it's implemented in C++ or Python doesn't really bother me as long as the design isn't compromised. If this was something that I wanted to make and distribute by myself, then I wouldn't even be here. But, even as an optional python plugin, it has to get approved into the repository to get proper exposure, and so I'm here to talk about the design.

Can python plugins have per-document settings that save with the .kra?

I wonder if this is going to satisfy what people want, or if they want other types of functionality when exporting multiple times. For example I have heard people that want to export out certain layers when they export, certain groups of layers.

Adding more per-target options should certainly be possible.

As for exporting certain layers and groups, that's mentioned in the proposal. There is a Source: field (and I'll admit, maybe that could be named better!) but the idea is that the user is able to enter layer or group name (like "sketch", "background", "normal_map", etc.) and have that target export only the contents of that particular layer. Leaving the Source: field blank (or using a macro like $MERGED) would simply export the entire merged artwork as expected.

I did consider using something like a drop-down or a tree-view of all the layers, but right now I feel like simply typing in the name of the layer or group that you want to export is a relatively clean and simple way of allowing users to selectively export certain layers/groups.

Is there any existing tickets in the bug tracker for people requesting stuff like this? Maybe we can see if we can tie some existing bugs and wish list items to this discussion.

On top of what you said about people wanting to export specific layers, I have seen people suggest that they'd like to be able to set the size or scale of their exports. (I can't remember whether that was in a bug report or on the IRC/forums/reddit/etc.) Anyway, this design would allow for not only that, but also exporting artwork at multiple sizes at once. Assuming that the plugin is 'discoverable' and users know of its existence.

This is an interesting idea and something I hear about on occasion from people. It could be neat for certain workflows.

Thanks. And, more importantly, thanks for the input!

rempt added a comment.Oct 2 2018, 7:19 AM

Note that the current export dialog allows you to save a .kra together with the exported file already.

@rempt - do different OSs have different export dialogs? I am on a Windows build right now and my export dialog does not have a "also save as KRA" option.

@emmetoneill - one other thing that might be tricky with this is that there are a lot more options for each format when they are exported then shown here. I am not sure how those would be configured and saved here. For example JPG has compression options, smoothing, metadata, and things like specifying a transparent fill color. Different file formats have different options.

Right now these options are asked when things are exported. If we have multiple exports, this dialog would appear multiple times unless you can do all the configuration on your UI somehow with all the different file types.

The more I am thinking about this, the more I am thinking this might be a better Python plugin as an example that people can customize to their needs.

Do we have any python plugins like this right now?

rempt added a comment.Oct 2 2018, 12:57 PM

It's in the export options dialog. It's only shown if there is a reason for it, i.e., the image contains something that cannot be saved in the target format.