Skip to content

Commit

Permalink
Add non-animated WEBP import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
scribblemaniac committed Dec 4, 2023
1 parent f965a9f commit b632734
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/ui/exportimageoptions.ui
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
<string>TIFF</string>
</property>
</item>
<item>
<property name="text">
<string>WEBP</string>
</property>
</item>
</widget>
</item>
<item>
Expand Down
4 changes: 4 additions & 0 deletions core_lib/src/structure/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,10 @@ bool Object::exportFrames(int frameStart, int frameEnd,
extension = ".bmp";
transparency = false;
}
if (formatStr == "WEBP" || formatStr == "webp") {
format = "WEBP";
extension = ".webp";
}
if (filePath.endsWith(extension, Qt::CaseInsensitive))
{
filePath.chop(extension.size());
Expand Down
1 change: 1 addition & 0 deletions core_lib/src/util/fileformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ QString detectFormatByFileNameExtension(const QString& fileName)
{ "tif", "TIF" },
{ "tiff", "TIF" },
{ "bmp", "BMP" },
{ "webp", "WEBP" },
{ "mp4", "MP4" },
{ "avi", "AVI" },
{ "gif", "GIF" },
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/util/fileformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ GNU General Public License for more details.
";;SWF(*.swf);;FLV(*.flv);;WEBM(*.webm);;WMV(*.wmv)"

#define PFF_IMAGE_FILTER \
QCoreApplication::translate("FileFormat", "Image formats") + " (*.png *.jpg *.jpeg *.bmp *.tif *.tiff);;PNG (*.png);;JPG(*.jpg *.jpeg);;BMP(*.bmp);;TIFF(*.tif *.tiff)"
QCoreApplication::translate("FileFormat", "Image formats") + " (*.png *.jpg *.jpeg *.bmp *.tif *.tiff *.webp);;PNG (*.png);;JPG(*.jpg *.jpeg);;BMP(*.bmp);;TIFF(*.tif *.tiff);;WEBP(*.webp)"

#define PFF_IMAGE_SEQ_FILTER \
QCoreApplication::translate("FileFormat", "Image formats") + " (*.png *.jpg *.jpeg *.bmp *.tif *.tiff);;PNG (*.png);;JPG(*.jpg *.jpeg);;BMP(*.bmp);;TIFF(*.tif *.tiff)"
QCoreApplication::translate("FileFormat", "Image formats") + " (*.png *.jpg *.jpeg *.bmp *.tif *.tiff *.webp);;PNG (*.png);;JPG(*.jpg *.jpeg);;BMP(*.bmp);;TIFF(*.tif *.tiff);;WEBP(*.webp)"

#define PFF_PALETTE_EXT_FILTER \
QCoreApplication::translate("FileFormat", "Palette formats") + " (*.xml *.gpl);;" + QCoreApplication::translate("FileFormat", "Pencil2D Palette") + " (*.xml);;" + QCoreApplication::translate("FileFormat", "GIMP Palette") + " (*.gpl)"
Expand Down

0 comments on commit b632734

Please sign in to comment.