是否可以从 Android 应用程序使用 GIMP 的图像功能?

发布于 2024-11-05 04:18:56 字数 174 浏览 4 评论 0原文

我在 Android 中使用 opencv 进行编程有一段时间了,现在我发现 Gimp 库要强大​​得多。我在哪里可以找到学习 Gimp 的起点? 我还想了解 Gimp 插件背后的基本概念。以前我在opencv中使用C API。我该如何编写android代码? 另外,我需要在 Windows 中安装哪些软件包才能开始使用 Gimp?

I was using opencv for some time for programming in Android, and I now see that the Gimp library is much stronger. Where can I find a starting point to learn Gimp?
I also want to know the basic concepts behind of Gimp plugins. In the past, I used C APIs in opencv. How could I write the code for android?
Also, what packages do I need to install in windows to start using Gimp?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黑凤梨 2024-11-12 04:18:56

尽管 GIMP 有一些独立的库来执行一些图像处理,但大多数图像处理是通过 GIMP 的核心程序或通过 GIMP 的插件完成的。两种方法都需要安装并运行整个程序(尽管不一定使用显示器)。

我对 Andorid 编程一无所知,也不知道如何在 C 中安装普通本机代码并从 Android 应用程序调用它 - 如果你非常熟悉它,你可能有机会尝试。

然而 GIMP 本身依赖于一个广泛的库生态系统,包括但不限于 glib、gtk+、cairo、pango、gegl,而这些库又可能有其他先决条件。由于 Windows 没有可用的包管理器来自动安装这些不同库的库和头文件,因此在 Windows 上本地使用这些库,尽管每个库的代码都是多平台的并且可以在 Windows 和其他操作系统上运行,但非常难。。如此困难,以至于那些为 Windows 构建 GIMP 的人自己在 Linux 环境中进行此工作,并从那里交叉编译了用于 Windows 的 GIMP。

如果您使用围绕 Android 的 Linux 内核的 GNU 生态系统,而不仅仅是裸露的 Android 环境,那么让所有这些库在 Android 上运行可能并不难(我对 Android 的了解不够,甚至不知道这是否可能) 。

总而言之:这将适合你,并且需要大量的研究。

GEGL(通用图形库)是 GIMP 的库之一,它的先决条件要少得多,可以用作普通库。我认为你可以只用 glib 和 Babl 作为先决条件来构建它。这个库将取代当前的 GIMP 核心,并重新实现大多数现有插件的操作 - 所以它可能对您来说足够了。
如果你能让 GEGL 在 Android 系统上运行并可用,与世界分享——就其自身而言,这将是一个相当于 Google Summer of Code 项目的项目。 (而且仍然比将 GIMP 代码放入其中用作其他应用程序的库要容易一个数量级)。

最后——如果您只需要几个 GIMP 效果,并且该效果是作为 GIMP 中的插件实现的,则插件的代码非常简单。因此,虽然很难在 Android 中获得整个 GIMP 环境,但从 GIMP 的源代码树中复制实际执行像素操作的函数并将它们转换为在应用程序中的 java 方法中工作并不困难。在这种情况下,请记住遵守许可证:GIMP 的插件代码遵循 GPLv3。 (GEGL 库只是 LGPL)

简而言之:不,您不能使用 GIMP 的“库”作为 Android 应用程序的本机代码 - 如果您可以使用 OpenCV,那么您很有可能成为可以使用 GEGL 代替。仅调整某些插件的算法来操作应用程序中的像素会更容易。

然而,如果您的应用程序允许将图像处理委托给基于 Internet 的服务器,那么设置一个 HTTP 应用程序来接收图像、使用 GIMP 对其进行处理并将其流式传输回来将是一件简单的事情。

(因此,您无法实时应用效果,但可以允许例如拍照,从菜单中选择一系列效果,然后将其发送到服务器进行处理)

ALthough GIMP dows have some standalone libraries that perform some image manipulation, most image manipulation is done either by GIMP's core program or through GIMP's plug-ins. Both approaches need to have the entire program installed and running (though not necessarily usin a display).

I know nothing on Andorid progrmaing, and don't knwo how can one install ordinary native code in C and call it from Android apps - if you are very familiar with it, you might have a chance in your attempt.

However GIMP itself relies on a extensive ecosystem of libraries, including, but not limited to, glib, gtk+, cairo, pango, gegl - and each of these in turn might have other pre-requisites. Since Windows does not have a working package manager to authomatically install libraries and header files of these various libraries, working with these natively on Windows, though the code of each of them is multiplatform and can run on Windows and other OSses,is very hard. So hard that hthe people who build GIMP for Windows themselves do so in a Linux environment, from where they cros-compile GIMP for Windows.

Making all of these libraries work on an Android is probably not hard if you are using the GNU ecosystem around the Android's Linux kernel , and not just the bare Android environment (I don't know enough about android to even know if that is possible).

All in all: it will be though for you, and demand a whole lot of research.

One of GIMP's libraries, the GEGL (Generic Graphics Library) has a lot less prerequistes, and can be used as an ordinary library. I think you can probably build it with just glib and Babl as prerequisites. This is the library that will replace current's GIMP core, and reimplement the operations of most existing plug-ins -- so it might be enough for you.
If you can get GEGL running and usable from an Android system share that with the World --it would be , in itelsef, a project worth of a Google Summer of Code project. (And still would be about an order of magnitude easier than getting GIMP code in there to be used as a library from other applications).

Finally -- if you want just a couple of GIMP's effects, if the effect is implemented as a Plug-in in GIMP, the plug-ins' code is quite straightforward. So, while it would be hard to get the whole GIMP environment inside Android, copying the functions that actually perform the pixel manipulation from GIMP's source tree and converting them to work in a java method inside your app would not be hard. Just remember to comply with the license in this case: GIMP's plugins code is under GPLv3. (the GEGL library is only LGPL)

In short: no, you can't use GIMP's "libraries" as native code from an Android app -if you can use OpenCV, you have a good chance of being able to use GEGL instead. Only orting the algorithms of certain plugins to manipulate pixels in your app would be easier.

However -- if your application would allow delegating Image Processing to an internet based server, setting up an HTTP application to receive a image, use GIMP to process it, and stream it back would be a simple thing to do.

(So, you could not apply effects in real time, but would allow one to, for example, take a photo, select a series of effects from menus, and send it to the server for processing)

沐歌 2024-11-12 04:18:56

加载画笔时 GIMP 使用相当多的内存。如果你放弃所有无用的插件,并从源代码构建它。您也许可以让它工作,但您必须将所有链接库直接构建到可执行文件中。

换句话说;将链接库作为静态构建直接构建到代码中。以这种方式,除非这些链接库之一调用另一个链接库,否则事情可以正常运行。

让库本身在操作系统上运行可能会为其他程序提供使用它们的机会。另外,GTK+(GIMP Tool Kit),GIMP的界面也比较臃肿、丑陋。

如果所有其他方法都失败了,您只需满足于一个较小的程序,其中包含您正在寻找的功能(级别、曲线、克隆工具、闪避和加深等)。图层也很好,但编辑大型百万像素图像开始相当快地耗尽内存,并且大多数 Android 设备没有交换分区。

GIMP uses quite a bit of memory when loading brushes. If you drop all of the useless plug-ins, and build it from source. You may be able to get it working but you will have to build ALL of the linked libraries directly into the executable.

In other words; build linked libraries directly into the code as a static build. In this manner things may function properly unless one of those linked libraries call another linked library.

Getting the libraries themselves to work on the OS may provide additional programs opportunities to use them. Additionally, GTK+ (GIMP Tool Kit), GIMP's interface is also rather bloated and ugly.

If all else fails, you'll simply have to settle for a smaller program with the features you're looking for on the fly ( Levels, Curves, the clone tool, dodge and burn, etc. ) Layers are also nice, but editing a a large megapixel image begins to eat up memory rather quickly and most android device don't have a swap partition.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文