libjpeg
NetCDF Expansion Pack
Install / Use
npx skills add Intelligent-Data-Design-Inc/NEP --skill libjpegInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of libjpeg
libjpeg scores 58/100 on our quality scale, 4164th of 4,675 Development & Engineering skills we index.
Its SKILL.md is 6.1 KB long, well organised into 11 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.
It has no GitHub stars yet, so there is no community track record; judge it on its content.
Maintenance, license and trust
- We could not determine when the repository was last updated.
- Our last check on 2026-09-28 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 68/100, with 3 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
libjpeg compared with similar skills
All 4 of these similar skills score higher than libjpeg; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| libjpeg (this skill)by Intelligent-Data-Design-Inc | 58 | 0 | — | SKILL.md |
| ai-job-searchby MadsLorentzen | 100 | 44.7k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | 1d ago | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 9d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 9d ago | SKILL.md |
Frequently asked questions
- How do I install libjpeg?
- Run
npx skills add Intelligent-Data-Design-Inc/NEP --skill libjpeg. The install tabs above show the steps for each supported agent. - Which AI agents does libjpeg work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is libjpeg safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 68/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is libjpeg still maintained?
- We could not determine when the repository was last updated.
Skill content
View source on GitHubname: libjpeg description: Using libjpeg / libjpeg-turbo for 8-bit JPEG decompression from memory, with build-system detection and error handling suitable for NEP UDF readers. metadata: author: netcdf-analysis version: "1.0" date: "2026-07-25"
libjpeg Skill
This skill covers the IJG/libjpeg-turbo C API for decompressing 8-bit JPEG images from an in-memory buffer. It is intended for NEP UDF handlers that need to decode encapsulated pixel data (e.g., DICOM JPEG Baseline frames).
Build System Detection
CMake
find_package(JPEG REQUIRED)
if(JPEG_FOUND)
target_link_libraries(myudf PRIVATE ${JPEG_LIBRARIES})
target_include_directories(myudf PRIVATE ${JPEG_INCLUDE_DIRS})
endif()
JPEG_LIBRARIES is typically libjpeg.so / libjpeg.dll.
JPEG_INCLUDE_DIRS contains jpeglib.h.
Autotools
AC_CHECK_HEADERS([jpeglib.h], [jpeg_header=yes], [jpeg_header=no])
AC_CHECK_LIB([jpeg], [jpeg_std_error],
[jpeg_lib=yes; JPEG_LIBS="-ljpeg"], [jpeg_lib=no])
AC_SUBST([JPEG_LIBS])
Link $(JPEG_LIBS) into the UDF library.
Headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <jpeglib.h>
<setjmp.h> is required for the error-recovery technique shown below.
Decompressing JPEG from Memory
The standard sequence is:
- Allocate
struct jpeg_decompress_struct cinfoand a custom error handler. - Override
error_exitso the library does not callexit(). jpeg_create_decompress(&cinfo).jpeg_mem_src(&cinfo, buffer, buffer_len).jpeg_read_header(&cinfo, TRUE).- Optionally set
cinfo.out_color_spacetoJCS_GRAYSCALEorJCS_RGB. jpeg_start_decompress(&cinfo).- Loop
jpeg_read_scanlines(). jpeg_finish_decompress(&cinfo).jpeg_destroy_decompress(&cinfo).
Error Handling
libjpeg's default error handler calls exit(). Always replace it:
struct my_error_mgr {
struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer;
};
typedef struct my_error_mgr *my_error_ptr;
static void
my_error_exit(j_common_ptr cinfo)
{
my_error_ptr myerr = (my_error_ptr)cinfo->err;
(*cinfo->err->output_message)(cinfo);
longjmp(myerr->setjmp_buffer, 1);
}
Usage:
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
if (setjmp(jerr.setjmp_buffer)) {
jpeg_destroy_decompress(&cinfo);
return NC_EIO;
}
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
jpeg_create_decompress(&cinfo);
/* ... decompress ... */
jpeg_destroy_decompress() and jpeg_abort() are the only safe calls on a
JPEG object that has reported a fatal error.
Full Memory-to-Memory Decompression Example
static int
decompress_jpeg(const void *src, size_t src_len,
int want_rgb, /* 0 = grayscale, 1 = RGB */
unsigned char **outp, size_t *out_lenp,
size_t *widthp, size_t *heightp, int *componentsp)
{
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
JSAMPARRAY scanline;
unsigned char *out = NULL;
unsigned char *out_ptr;
size_t row_stride;
int retval = 0;
*outp = NULL;
*out_lenp = 0;
if (setjmp(jerr.setjmp_buffer)) {
jpeg_destroy_decompress(&cinfo);
free(out);
return -1;
}
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
jpeg_create_decompress(&cinfo);
jpeg_mem_src(&cinfo, (const unsigned char *)src, (unsigned long)src_len);
jpeg_read_header(&cinfo, TRUE);
if (want_rgb)
cinfo.out_color_space = JCS_RGB;
else
cinfo.out_color_space = JCS_GRAYSCALE;
jpeg_start_decompress(&cinfo);
*widthp = cinfo.output_width;
*heightp = cinfo.output_height;
*componentsp = cinfo.output_components;
row_stride = cinfo.output_width * cinfo.output_components * sizeof(JSAMPLE);
*out_lenp = row_stride * cinfo.output_height;
out = malloc(*out_lenp);
if (!out) {
jpeg_destroy_decompress(&cinfo);
return -1;
}
scanline = (*cinfo.mem->alloc_sarray)
((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1);
out_ptr = out;
while (cinfo.output_scanline < cinfo.output_height) {
jpeg_read_scanlines(&cinfo, scanline, 1);
memcpy(out_ptr, scanline[0], row_stride);
out_ptr += row_stride;
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
*outp = out;
return 0;
}
Important API Details
jpeg_mem_src()requires libjpeg v8 or later, or libjpeg-turbo withMEM_SRCDST_SUPPORTED. It treats an empty input buffer as a fatal error.jpeg_read_header()fillscinfo.image_width,cinfo.image_height, andcinfo.num_components(the JPEG's native color space).cinfo.output_width,cinfo.output_height, andcinfo.output_componentsare computed afterjpeg_start_decompress()and reflect any requested color conversion.JSAMPLEisunsigned charfor 8-bit builds. For 12-bit builds the library is compiled separately and usesJ12SAMPLE; NEP DICOM Sprint 2 targets 8-bit JPEG Baseline only.- Use
cinfo.mem->alloc_sarray()for the one-scanline work buffer so the library manages its lifetime. The returned buffer must not be freed by the caller. - Always validate
output_width,output_height, andoutput_componentsagainst expected values before copying into the output buffer.
Color Space Notes
| Input colorspace | out_color_space | Output channels |
|------------------|-------------------|-----------------|
| Grayscale | JCS_GRAYSCALE | 1 |
| YCbCr / RGB | JCS_RGB | 3 (interleaved) |
| CMYK | JCS_CMYK | 4 |
For DICOM, PhotometricInterpretation of MONOCHROME1 or MONOCHROME2
corresponds to JCS_GRAYSCALE. RGB images are normalized to JCS_RGB for the
NetCDF view.
References
- libjpeg-turbo documentation: https://libjpeg-turbo.org/
- IJG libjpeg
libjpeg.txt:https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/doc/libjpeg.txt example.cin the libjpeg-turbo source tree shows file-based decompression with custom error handling.
Related Skills
ai-job-search
44.7kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
