标签: libpng

在PHP中渲染波形 - 如何生成更加压缩的渲染?

我通过使用跛脚编码器对其进行下采样,然后从结果数据点绘制波形,在PHP中渲染波形.我目前正在获得这样的图像:

在此输入图像描述

我想要做的是修改我的代码,使波形的表观动态范围基本上"压缩".要生成看起来更像这样的波形:

在此输入图像描述

我目前用来渲染每个数据点高度的公式如下: -

 // draw this data point
          // relative value based on height of image being generated
          // data values can range between 0 and 255
           $v = (int) ( $data / 255 * $height );


          // don't print flat values on the canvas if not necessary
          if (!($v / $height == 0.5 && !$draw_flat))
            // draw the line on the image using the $v value and centering it vertically on the canvas
            imageline(
              $img,
              // x1
              (int) …
Run Code Online (Sandbox Code Playgroud)

php math libpng

11
推荐指数
1
解决办法
711
查看次数

在android ndk项目中添加libpng

我搜索了很多关于将libpng链接到我的android ndk项目的主题,但我找到了正确的答案,我希望有人会帮助我.

这是我的项目的层次结构:

JNI

different_cpp_files
different_hpp_files
Android.mk
libpng
    different_cpp_files
    different_hpp_files
    Android.mk
Run Code Online (Sandbox Code Playgroud)

libpng文件夹中的Android.mk:


LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LS_C=$(subst $(1)/,,$(wildcard $(1)/*.c))

LOCAL_MODULE := png

LOCAL_SRC_FILES := \

$(filter-out example.c pngtest.c,$(call LS_C,$(LOCAL_PATH)))

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)

LOCAL_EXPORT_LDLIBS := -lz

include $(BUILD_STATIC_LIBRARY)
Run Code Online (Sandbox Code Playgroud)

我想一切都在这里..

jni文件夹中的Android.mk:


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LS_CPP=$(subst $(1)/,,$(wildcard $(1)/*.cpp))

LOCAL_MODULE    := pacman

LOCAL_CFLAGS    := -Wno-psabi

LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH))

LOCAL_LDLIBS    := -landroid -llog -lEGL -lGLESv1_CM -lOpenSLES

LOCAL_STATIC_LIBRARIES := android_native_app_glue png

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)

$(call import-module,libpng)
Run Code Online (Sandbox Code Playgroud)

最后一行显示我得到了像native_app_glue lib这样的libpng(在android-ndk源代码目录中)现在我想从我的项目中编译libpng.我需要在Android.mk文件中进行哪些更改?

libpng android-ndk

11
推荐指数
1
解决办法
9545
查看次数

无法构建R包"png"Fedora 20

我正在尝试构建R软件包png,repo说libpng需要提供.

我运行Linux Fedora 20发行版

看起来我有它......

[root@localhost bin]# yum install libpng
Loaded plugins: langpacks, refresh-packagekit
Package 2:libpng-1.6.3-3.fc20.x86_64 already installed and latest version
Nothing to do
Run Code Online (Sandbox Code Playgroud)

但是当我尝试安装它时:

> install.packages("png")
Installing package into ‘/home/statquant/R/x86_64-redhat-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 Kb)
opened URL
==================================================
downloaded 24 Kb

* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG …
Run Code Online (Sandbox Code Playgroud)

install r libpng fedora20

11
推荐指数
2
解决办法
8885
查看次数

如何在windows上安装libpng-dev?

我正在尝试为节点安装imagemin-pngquant模块:

https://www.npmjs.org/package/imagemin-pngquant

但是,当我运行命令时

npm install imagemin-pngquant --save-dev
Run Code Online (Sandbox Code Playgroud)

我得到以下错误:

  warn : pngquant pre-build test failed
  info : compiling from source
 error : Error: pngquant failed to build, make sure that libpng-dev is installed
 at ChildProcess.exithandler (child_process.js:637:15)
 at ChildProcess.EventEmitter.emit (events.js:98:17)
 at maybeClose (child_process.js:735:16)
 at Socket.<anonymous> (child_process.js:948:11)
 at Socket.EventEmitter.emit (events.js:95:17)
 at Pipe.close (net.js:466:12)
Run Code Online (Sandbox Code Playgroud)

如何安装pngquant所需的libpng-dev库?

png libpng node-modules

11
推荐指数
2
解决办法
1万
查看次数

Android:删除OpenCV旧版本会解决Libpng漏洞警告吗?

我收到了来自Google Play商店的电子邮件 - "Google Play警告:您正在使用易受攻击的libpng版本".

电子邮件包含以下信息 - https://support.google.com/faqs/answer/7011127

我没有在我的应用程序中使用libpng库.但是,在我的Android应用程序中,我使用的是OpenCV2.4.5库.在互联网上搜索后,我发现OpenCV库使用了libpng.

我的问题 - 将OpenCV2.4.5升级到OpenCV3.1.0将解决"易受攻击的libpng版本"警告?

libpng android-security

11
推荐指数
2
解决办法
3655
查看次数

matplotlib和libpng问题与ipython笔记本

我试图使用ipython笔记本.我安装了所有依赖库.但是,在Ipython控制台中启动ipython或"savefig"功能时,我无法使用"--pylab = inline"选项.当我尝试执行其中任何一个时,由于执行matplotlib而返回错误消息"RuntimeError:无法创建写入结构".此外,来自notebookApp提示的警告说"libpng警告:使用libpng-1.2.41构建的应用程序,但运行1.5.13".

但是,我安装了最新的libpng(1.5.13),卸载了pp卸载的matplotlib,并重新安装了pp install的matplotlib(在构建过程中,我可以看到libpng1.5.13用于构建matplotlib).

我的系统配置是Mac OS X10.6,python2.7.有人有类似的经历或一些建议吗?

以下是回溯错误:

[<matplotlib.lines.Line2D at 0x106066d50>]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.pyc in show(close)
    100     try:
    101         for figure_manager in Gcf.get_all_fig_managers():
--> 102             send_figure(figure_manager.canvas.figure)
    103     finally:
    104         show._to_draw = []

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.pyc in send_figure(fig)
    209     """
    210     fmt = InlineBackend.instance().figure_format
--> 211     data = print_figure(fig, fmt)
    212     # print_figure will return None if there's nothing to draw:
    213     if data is None:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in print_figure(fig, fmt)
    102     try:
    103         bytes_io = BytesIO()
--> …
Run Code Online (Sandbox Code Playgroud)

python matplotlib ipython libpng ipython-notebook

10
推荐指数
2
解决办法
9714
查看次数

如何正确安装libpng?

我试图访问我的C代码中的png像素数据.我找到了这个库libpng.我从这个网站下载了最新版本,我使用的是Ubuntu 14.04.我按照INSTALL文件中的说明操作.一切顺利.然后我尝试用gcc编译这段代码.但我收到了这个:

/tmp/ccWa9LDO.o: In function `read_png_file':
test.c:(.text+0x13c): undefined reference to `png_sig_cmp'
test.c:(.text+0x16f): undefined reference to `png_create_read_struct'
test.c:(.text+0x1a0): undefined reference to `png_create_info_struct'
test.c:(.text+0x1db): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x20c): undefined reference to `png_init_io'
test.c:(.text+0x220): undefined reference to `png_set_sig_bytes'
test.c:(.text+0x239): undefined reference to `png_read_info'
test.c:(.text+0x252): undefined reference to `png_get_image_width'
test.c:(.text+0x271): undefined reference to `png_get_image_height'
test.c:(.text+0x290): undefined reference to `png_get_color_type'
test.c:(.text+0x2af): undefined reference to `png_get_bit_depth'
test.c:(.text+0x2c4): undefined reference to `png_set_interlace_handling'
test.c:(.text+0x2e3): undefined reference to `png_read_update_info'
test.c:(.text+0x2fc): undefined reference to `png_set_longjmp_fn' …
Run Code Online (Sandbox Code Playgroud)

c ubuntu linker libpng

10
推荐指数
1
解决办法
1万
查看次数

尝试使用libpng加载图像时Windows上的运行时错误

我正在使用pHash,该库使用libpng.我在运行程序时遇到问题,因为libpng无法加载PNG文件.

  • libpng的版本:1.4.19
  • 平台:Windows 10
  • 环境:Visual Studio 2015

不重要的

如果你提出以下问题......

  1. 图像的路径是否正确?是
  2. 图像是有效的PNG文件吗?是

代码细节

库pHash使用CImg,他们使用的CImg版本有点旧我认为:

#define cimg_version 148 // In CImg.h
Run Code Online (Sandbox Code Playgroud)

我调试了库,问题发生在CImg.h(包含在pHash VC++项目中):

CImg<T>& _load_png(std::FILE *const file, const char *const filename) {
      if (!file && !filename)
        throw CImgArgumentException(_cimg_instance
                                    "load_png() : Specified filename is (null).",
                                    cimg_instance);
      // Open file and check for PNG validity
      if (Buffer) strcat(Buffer, "Checking PNG availability\r\n");
      const char *volatile nfilename = filename; // two 'volatile' here to remove …
Run Code Online (Sandbox Code Playgroud)

c++ visual-c++ cimg libpng

10
推荐指数
1
解决办法
739
查看次数

如何将图像显示到XCB窗口?

我在将图像(使用libpng提取的PNG)显示到XCB窗口时遇到问题,它总是完全为空/白色.我很确定PNG提取是正确的,因为我可以完美地将它重新写入另一个文件.

我已经尝试了所有我发现的东西(解释,指南,文档),但我的想法已经不多了:

  • 使用从PNG获取的数据创建xcb_pixmap_t调用xcb_create_pixmap_from_bitmap_data(),然后调用xcb_copy_area()事件循环的EXPOSE部分.
  • 创建一个xcb_image_t*调用,xcb_image_create_from_bitmap_data()然后尝试将其映射到窗口xcb_image_put().我甚至试图用每个像素显示xcb_image_put_pixel(),但没有成功.

代码示例:

  xcb_pixmap_t pixmap = xcb_create_pixmap_from_bitmap_data(
                            connection, // xcb_connect(0, 0)    (type: xcb_connection_t*)
                            window, // xcb_generate_id(connection)    (type: xcb_window_t)
                            img.getData(), // uint8_t*
                            img.getWidth(), // 128
                            img.getHeight(), // 128
                            img.getBitDepth(), // 8
                            screen->black_pixel, // screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data    (type: xcb_screen_t*)
                            screen->white_pixel,
                            nullptr);

   // "img" is an instance of my own custom class, result of PNG reading
  xcb_image_t* image = xcb_image_create_from_bitmap_data(
                              img.getData(),
                              img.getWidth(),
                              img.getHeight()); // image->data seems fine …
Run Code Online (Sandbox Code Playgroud)

c linux x11 libpng xcb

10
推荐指数
1
解决办法
1062
查看次数

meld - gi._glib.GError:图标'meld-change-apply-right'不在主题中.安装有什么问题?

我已经设法安装了meld 3.14.2和所有依赖包,通过从源代码编译每个包,并且所有包安装在NFS共享上,--prefix=<base>/meld用于meld工具&& --prefix=<base>/meld/deps用于依赖项.

最后,我调用了该工具,我可以看到GUI.但是,当我尝试进行一些功能测试时,它会引发我的错误.我从未使用过该工具.所以,我不知道它应该如何正常工作.但是用户已经指出了以下错误,我猜也可能存在许多其他错误.但以下是其中之一.

$meld
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
II 1
Traceback (most recent call last):
File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/newdifftab.py", line 117, in on_button_compare_clicked
tab = self.diff_methods[self.diff_type](compare_paths)
File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/meldwindow.py", line 647, in append_filediff
doc = filediff.FileDiff(len(files))
File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/filediff.py", line 281, in __init__
from meld.gutterrendererchunk import GutterRendererChunkAction
File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 33, in <module>
class GutterRendererChunkAction(GtkSource.GutterRendererPixbuf):
File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 38, in GutterRendererChunkAction
MODE_REPLACE: load("meld-change-apply-right"),
File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 30, …
Run Code Online (Sandbox Code Playgroud)

gtk glib meld libpng gio

9
推荐指数
3
解决办法
930
查看次数