PNG Compression can now be set, writing uncompressed PNG's is significantly faster for high resolution images - 2k.

This commit is contained in:
Campbell Barton 2010-07-17 13:29:55 +00:00
parent 30b712ed68
commit 22c6b7d174
5 changed files with 30 additions and 16 deletions

@ -295,6 +295,7 @@ class RENDER_PT_output(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
file_format = rd.file_format
wide_ui = context.region.width > narrowui
layout.prop(rd, "output_path", text="")
@ -310,11 +311,15 @@ class RENDER_PT_output(RenderButtonsPanel):
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
if rd.file_format in ('AVI_JPEG', 'JPEG'):
if file_format in ('AVI_JPEG', 'JPEG'):
split = layout.split()
split.prop(rd, "file_quality", slider=True)
if file_format == 'PNG':
split = layout.split()
split.prop(rd, "file_quality", slider=True, text="Compression")
elif rd.file_format == 'MULTILAYER':
elif file_format == 'MULTILAYER':
split = layout.split()
col = split.column()
@ -323,7 +328,7 @@ class RENDER_PT_output(RenderButtonsPanel):
if wide_ui:
col = split.column()
elif rd.file_format == 'OPEN_EXR':
elif file_format == 'OPEN_EXR':
split = layout.split()
col = split.column()
@ -340,7 +345,7 @@ class RENDER_PT_output(RenderButtonsPanel):
col = subsplit.column()
col.prop(rd, "exr_preview")
elif rd.file_format == 'JPEG2000':
elif file_format == 'JPEG2000':
split = layout.split()
col = split.column()
col.label(text="Depth:")
@ -351,7 +356,7 @@ class RENDER_PT_output(RenderButtonsPanel):
col.prop(rd, "jpeg2k_preset", text="")
col.prop(rd, "jpeg2k_ycc")
elif rd.file_format in ('CINEON', 'DPX'):
elif file_format in ('CINEON', 'DPX'):
split = layout.split()
col = split.column()
col.prop(rd, "cineon_log", text="Convert to Log")
@ -363,15 +368,15 @@ class RENDER_PT_output(RenderButtonsPanel):
col.prop(rd, "cineon_white", text="White")
col.prop(rd, "cineon_gamma", text="Gamma")
elif rd.file_format == 'TIFF':
elif file_format == 'TIFF':
split = layout.split()
split.prop(rd, "tiff_bit")
elif rd.file_format == 'QUICKTIME_CARBON':
elif file_format == 'QUICKTIME_CARBON':
split = layout.split()
split.operator("scene.render_data_set_quicktime_codec")
elif rd.file_format == 'QUICKTIME_QTKIT':
elif file_format == 'QUICKTIME_QTKIT':
split = layout.split()
col = split.column()
col.prop(rd, "quicktime_codec_type", text="Video Codec")

@ -1180,6 +1180,10 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
}
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
ibuf->ftype= PNG;
if(imtype==R_PNG)
ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */
}
#ifdef WITH_DDS
else if ((imtype==R_DDS)) {

@ -850,8 +850,6 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* border */
setlinestyle(3);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
glBegin(GL_LINE_LOOP);
@ -873,14 +871,16 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
y1+= a;
y2-= a;
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
uiSetRoundBox(15);
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
setlinestyle(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
/* draw grease-pencil (image aligned) */

@ -103,6 +103,11 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags)
int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY;
FILE *fp = 0;
/* use the jpeg quality setting for compression */
int compression;
compression= (int)(((float)(ibuf->ftype & 0xff) / 11.1111f));
compression= compression < 0 ? 0 : (compression > 9 ? 9 : compression);
bytesperpixel = (ibuf->depth + 7) >> 3;
if ((bytesperpixel > 4) || (bytesperpixel == 2)) {
printf("imb_savepng: unsupported bytes per pixel: %d\n", bytesperpixel);
@ -201,10 +206,10 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags)
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS);
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
*/
png_set_compression_level(png_ptr, compression);
// png image settings
png_set_IHDR(png_ptr,
info_ptr,

@ -2037,8 +2037,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE);
RNA_def_property_int_sdna(prop, NULL, "quality");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies");
RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, Compression for PNG's");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
/* Tiff */