Using skia library to create a copy of any image format and convert it to webp format

463 views
Skip to first unread message

1873 Chinmay Parkhi

unread,
Apr 13, 2023, 8:32:05 AM4/13/23
to skia-discuss
I need to use skia library such that a image of any format is copied and converted to webp image file format and save it to a work directory . Can anyone suggest steps to proceed  with this ?

Leon Scroggins

unread,
Apr 13, 2023, 10:57:51 AM4/13/23
to skia-d...@googlegroups.com
Skia has SkWebpEncoder to encode to a webp file, but we only have decoders for a few formats (including jpeg and png). You'll need another library to support more exotic formats.

On Thu, Apr 13, 2023 at 8:32 AM 1873 Chinmay Parkhi <cpar...@gmail.com> wrote:
I need to use skia library such that a image of any format is copied and converted to webp image file format and save it to a work directory . Can anyone suggest steps to proceed  with this ?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/290bdef5-be60-40ba-965e-aae321883550n%40googlegroups.com.


--

 •  Leon Scroggins

 •  alphabetworkersunion.org



1873 Chinmay Parkhi

unread,
Apr 17, 2023, 7:14:30 AM4/17/23
to skia-discuss
Thanks Leon for your input....

So as per your suggestion I was just trying to build a basic test application using SkWebpEncoder which will encode a bitmap of a image into a webp format using lossy compression.
I have built skia in both modes  (Static as well as shared).
But when I try to run my test code using skia library I get such errors: (I am not sure why these errors are coming up as within include/core , SkAlphaType.h file is present )
If by chance I am missing any step for running test code using skia library, please let me know .

Error :==
In file included from test.cc:33:
include/core/SkBitmap.h:11:10: fatal error: include/core/SkAlphaType.h: No such file or directory
   11 | #include "include/core/SkAlphaType.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Thanks,
Chinmay Parkhi

Leon Scroggins

unread,
Apr 17, 2023, 10:39:51 AM4/17/23
to skia-d...@googlegroups.com
I'm not sure how you're building, but my guess would be that you are not properly telling the compiler where to search for includes.



--

 •  Leon Scroggins

 •  alphabetworkersunion.org



1873 Chinmay Parkhi

unread,
Apr 17, 2023, 10:56:45 AM4/17/23
to skia-discuss
I'm trying to compile my sample code using skia by using following command :

g++ -I/path/to/skia/include test.cpp -o test

Basically I am using  the "-I" option to specify the include directory for Skia

Brian Osman

unread,
Apr 17, 2023, 11:01:06 AM4/17/23
to skia-d...@googlegroups.com
You should set that to just -Ipath/to/skia, all of Skia's includes are written to be relative to the top level directory.

1873 Chinmay Parkhi

unread,
Apr 25, 2023, 9:21:08 AM4/25/23
to skia-discuss
I am getting a linker error when I am trying to link skia with my project.

Error -->
ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::resize(unsigned long, char)
>>> referenced by tiff_parser.cc
>>>               libpiex.tiff_parser.o:(piex::TiffParser::GetPreviewImageData(piex::TiffContent const&, piex::PreviewImageData*))

ld.lld: error: undefined symbol: std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)
>>> referenced by tiff_parser.cc
>>>               libpiex.tiff_parser.o:(piex::TiffParser::ParseGpsData(piex::tiff_directory::TiffDirectory const*, piex::TiffContent*))


Can anyone suggest solution for this ?

K. Moon

unread,
Apr 25, 2023, 9:53:31 AM4/25/23
to skia-d...@googlegroups.com
It looks like you're trying to link with different versions of the C++ standard library.

1873 Chinmay Parkhi

unread,
Apr 28, 2023, 9:12:04 AM4/28/23
to skia-discuss
Oh it might be the case. Thanks for pointing it out.
I have one another chromium project (cef-109) which has skia build within it.
I have found that we can also use that skia directly instead of building skia separately and using it in my project.
But by including just the 'libskia.a' in my project's linking stage is not giving proper results and giving linker errors.
Since skia is built in that chromium project , are there any specific steps to be followed for linking and using skia in that project ?

K. Moon

unread,
Apr 28, 2023, 12:09:37 PM4/28/23
to skia-d...@googlegroups.com
I don't think there's enough information in your description to know what sort of linking errors you're running into, but linking issues aren't really a Skia-specific problem. I'd suggest asking in a general software development forum, like Stack Overflow.

1873 Chinmay Parkhi

unread,
May 3, 2023, 8:43:05 AM5/3/23
to skia-discuss
These linker errors seems specific to skia :

ld.lld: error: undefined symbol: SkData::MakeFromFileName(char const*)
ld.lld: error: undefined symbol: SkImage::MakeFromEncoded(sk_sp<SkData>, std::Cr::optional<SkAlphaType>)

I have included libskia.a in my linker step for my project as well as included the required include files.
Am I missing anything ?


Brian Osman

unread,
May 3, 2023, 8:54:40 AM5/3/23
to skia-d...@googlegroups.com
Did you make sure to include src/core/SkData.cpp when you built libskia? (How are you building Skia - are you using GN, or did you make a custom Visual Studio project or something?)

1873 Chinmay Parkhi

unread,
May 4, 2023, 9:20:11 AM5/4/23
to skia-discuss
I am not building skia separately. It was build when I built cef for my project using command : " ninja -C out/Release_GN_x64 cef "
Cef's build.gn file is building skia and giving a libskia.a file in "out/Release_GN_x6/obj/proj/skia/" directory.
I am currently using that libskia.a for my project.

Build gn for cef : https://github.com/chromiumembedded/cef/blob/master/BUILD.gn

1873 Chinmay Parkhi

unread,
May 5, 2023, 9:31:51 AM5/5/23
to skia-discuss
Cef is internally using this build.gn for building skia :- https://source.chromium.org/chromium/chromium/src/+/main:skia/BUILD.gn

As per build configuration defined inside this file, SkData.cpp is being included in  skia_core_sources   ( as a part of  skia_core_and_effects)
Still I am getting same linker error. 

aron Leonard

unread,
May 13, 2023, 7:47:25 PM5/13/23
to skia-d...@googlegroups.com
Hi there,

I hope you're doing well. I noticed that you're still experiencing issues despite the build configuration defined in the file. I'm sorry to hear that. Can you give me more details on the linker error you're getting? This would help me provide better troubleshooting steps.

In the meantime, have you tried checking if all the necessary dependencies are installed and up to date? Sometimes updating dependencies can help with linker errors.

Please let me know if there's anything else I can do to assist you. I'm here to help.

Best regards,
Aron

1873 Chinmay Parkhi

unread,
May 15, 2023, 8:46:37 AM5/15/23
to skia-discuss
Hii,

I checked the build.gn which is responsible for building skia. 
In that file within component "skia" there is a public_deps included named ("skia_core_and_effects") which in turn is built from the template "skia_source_set" which installs all the necessary dependencies and third party requirements by skia using "skia_config_library". 
So as per this build.gn , it seems like when we use libskia.a it should be built with all the core skia classes which are included in skia_core_sources, but when I try to call a method from such a skia class (for eg. - SkData::MakefromFileName method it gives a linker error as given below --
ld.lld: error: undefined symbol: SkData::MakeFromFileName(char const*)

I am referring this build.gn file :-  https://source.chromium.org/chromium/chromium/src/+/main:skia/BUILD.gn
I suspect either this build.gn is not building or linking all the skia source files in the final libskia.a 
So just wanted a input that whether this build.gn is a correct way for building skia or do I need to configure anything else within it ?
Reply all
Reply to author
Forward
0 new messages