Compare commits

..

No commits in common. "main" and "v1.8.0" have entirely different histories.
main ... v1.8.0

10 changed files with 25 additions and 438 deletions

View File

@ -1,57 +1,3 @@
# Image Editor Plus
![Image Editor Plus](doc/images/featured.png)
Image Editor Plus is a Blender add-on that lets you modify your image in seconds. Clear, fill, flip, rotation, adjusting colors, and applying some filters in just a few clicks without external editors such as PhotoShop or Gimp.
This add-on extends the UV/Image Editor in Blender and provides the following operations.
- Cut/Copy/Paste
- Clear, Fill
- Crop
- Adjust hue/saturation
- Adjust brightness/contrast
- Adjust gamma
- Adjust color curve
- Replace color
- Flip, Rotate
- Canvas size
- Offset
- Apply filters
NOTE: Currently, text editing is provided as a separate add-on: [Image Editor+ Text Tool](https://superhivemarket.com/products/imedp-text-tool)
These image operations can be applied to packed/unpacked images, and reflected to the 3D model view immediately.
You can make a selection to edit the desired area on your image (currently only rectangle selection supported).
![Adjust color](doc/images/adjust_color.png)
It's easy to copy/paste a selection or an entire image. The pasted images are displayed as layers, and they can be moved, rotated or scaled.
NOTE: To display pasted layers in the 3D View, you need to use a [Image Layers Node](https://superhivemarket.com/products/image-layers-node) instead of built-in Texture Node.
![Pasted layers](doc/images/pasted_layers_2.png)
## Filters
By applying the some filters, you can add special effects to your images.
- Blur
- Sharpen
- Add noise
- Pixelize (Mosaic)
- Make seamless
- Normal map
"Make seamless" filter is useful for making your image tileable.
![Filters](doc/images/filters.png)
## Normal Map Generator
Normal Map is a texture where every pixel represents a normal vector and is used to add bumps to a surface.
This add-on uses a height map (black: low, white: high) as input and can convert it to a normal map.
![Normal map](doc/images/normal_map.png)
Image Editor Plus is an add-on that lets you modify your image in seconds. Clear, fill, flip, rotation, adjusting colors, and applying some filters in just a few clicks without external editors such as PhotoShop or Gimp.

View File

@ -1,5 +1,5 @@
'''
Copyright (C) 2021 - 2025 Akaneyu
Copyright (C) 2021 - 2024 Akaneyu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
bl_info = {
"name": "Image Editor Plus",
"author": "akaneyu",
"version": (1, 10, 0),
"version": (1, 8, 0),
"blender": (3, 3, 0),
"location": "Image",
"warning": "",
@ -64,7 +64,6 @@ classes = [
operators.IMAGE_EDITOR_PLUS_OT_flip,
operators.IMAGE_EDITOR_PLUS_OT_rotate,
operators.IMAGE_EDITOR_PLUS_OT_scale,
operators.IMAGE_EDITOR_PLUS_OT_change_canvas_size,
operators.IMAGE_EDITOR_PLUS_OT_flip_layer,
operators.IMAGE_EDITOR_PLUS_OT_rotate_layer,
operators.IMAGE_EDITOR_PLUS_OT_rotate_layer_arbitrary,
@ -80,9 +79,7 @@ classes = [
operators.IMAGE_EDITOR_PLUS_OT_add_noise,
operators.IMAGE_EDITOR_PLUS_OT_pixelize,
operators.IMAGE_EDITOR_PLUS_OT_make_seamless,
operators.IMAGE_EDITOR_PLUS_OT_normal_map,
ui.IMAGE_EDITOR_PLUS_OT_scale_dialog,
ui.IMAGE_EDITOR_PLUS_OT_change_canvas_size_dialog,
ui.IMAGE_EDITOR_PLUS_OffsetPropertyGroup,
ui.IMAGE_EDITOR_PLUS_OT_offset_dialog,
ui.IMAGE_EDITOR_PLUS_OT_adjust_color_dialog,
@ -95,7 +92,6 @@ classes = [
ui.IMAGE_EDITOR_PLUS_OT_add_noise_dialog,
ui.IMAGE_EDITOR_PLUS_OT_pixelize_dialog,
ui.IMAGE_EDITOR_PLUS_OT_make_seamless_dialog,
ui.IMAGE_EDITOR_PLUS_OT_normal_map_dialog,
ui.IMAGE_EDITOR_PLUS_UL_layer_list,
ui.IMAGE_EDITOR_PLUS_MT_edit_menu,
ui.IMAGE_EDITOR_PLUS_MT_layers_menu,

View File

@ -1,5 +1,5 @@
'''
Copyright (C) 2021 - 2025 Akaneyu
Copyright (C) 2021 - 2024 Akaneyu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -136,7 +136,6 @@ def draw_handler():
# release the selection if the image is changed
if area_session.selection or area_session.selection_region:
if area_session.prev_image:
if img != area_session.prev_image:
cancel_selection(context)

View File

@ -1,5 +1,5 @@
'''
Copyright (C) 2021 - 2025 Akaneyu
Copyright (C) 2021 - 2023 Akaneyu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -26,9 +26,7 @@ class IMAGE_EDITOR_PLUS_OT_make_selection(bpy.types.Operator):
bl_idname = "image_editor_plus.make_selection"
bl_label = "Make Selection"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self):
self.lmb = False
def modal(self, context, event):
@ -45,14 +43,12 @@ class IMAGE_EDITOR_PLUS_OT_make_selection(bpy.types.Operator):
if area_session.selection_region:
area_session.selection_region[1] = region_pos
else:
area_session.selection_region = [region_pos, region_pos]
elif event.type == 'LEFTMOUSE':
if event.value == 'PRESS':
self.lmb = True
region_pos = [event.mouse_region_x, event.mouse_region_y]
area_session.selection_region = [region_pos, region_pos]
elif event.value == 'RELEASE':
self.lmb = False
@ -401,9 +397,7 @@ class IMAGE_EDITOR_PLUS_OT_move_layer(bpy.types.Operator):
bl_idname = "image_editor_plus.move_layer"
bl_label = "Move Layer"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self):
self.start_input_position = [0, 0]
self.start_layer_location = [0, 0]
@ -770,77 +764,6 @@ class IMAGE_EDITOR_PLUS_OT_scale(bpy.types.Operator):
return {'FINISHED'}
class IMAGE_EDITOR_PLUS_OT_change_canvas_size(bpy.types.Operator):
"""Apply settings"""
bl_idname = "image_editor_plus.change_canvas_size"
bl_label = "Change Canvas Size"
width: bpy.props.IntProperty()
height: bpy.props.IntProperty()
expand_from_center: bpy.props.BoolProperty()
use_background_color: bpy.props.BoolProperty()
def execute(self, context):
wm = context.window_manager
props = wm.imageeditorplus_properties
if self.use_background_color:
color = props.background_color[:] + (1.0,)
else:
color = (0, 0, 0, 0)
img = context.area.spaces.active.image
if not img:
return {'CANCELLED'}
width, height = img.size
pixels = utils.read_pixels_from_image(img)
if self.width > width or self.height > height:
expand_width = self.width - width if self.width > width else 0
expand_height = self.height - height if self.height > height else 0
if self.expand_from_center:
expand_left = int(expand_width / 2)
expand_top = int(expand_height / 2)
expand_right = expand_width - expand_left
expand_bottom = expand_height - expand_top
else:
expand_left, expand_top = 0, 0
expand_right = expand_width
expand_bottom = expand_height
new_pixels = np.pad(pixels, ((expand_bottom, expand_top),
(expand_left, expand_right), (0, 0)),
constant_values=np.array(((color, color), (color, color), (0, 0)),
dtype=object))
else:
new_pixels = pixels
if self.width < width or self.height < height:
shrink_width = width - self.width if self.width < width else 0
shrink_height = height - self.height if self.height < height else 0
if self.expand_from_center:
shrink_left = int(shrink_width / 2)
shrink_top = int(shrink_height / 2)
else:
shrink_left, shrink_top = 0, 0
if self.height < height:
new_pixels = new_pixels[height - self.height - shrink_top:height - shrink_top,
shrink_left:self.width + shrink_left]
else:
new_pixels = new_pixels[0:self.height,
shrink_left:self.width + shrink_left]
img.scale(self.width, self.height)
utils.write_pixels_to_image(img, new_pixels)
app.refresh_image(context)
return {'FINISHED'}
class IMAGE_EDITOR_PLUS_OT_flip_layer(bpy.types.Operator):
"""Flip the layer"""
bl_idname = "image_editor_plus.flip_layer"
@ -891,9 +814,7 @@ class IMAGE_EDITOR_PLUS_OT_rotate_layer_arbitrary(bpy.types.Operator):
bl_idname = "image_editor_plus.rotate_layer_arbitrary"
bl_label = "Rotate Layer Arbitrary"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self):
self.start_input_position = [0, 0]
self.start_layer_angle = 0
@ -975,9 +896,7 @@ class IMAGE_EDITOR_PLUS_OT_scale_layer(bpy.types.Operator):
bl_idname = "image_editor_plus.scale_layer"
bl_label = "Scale Layer"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self):
self.start_input_position = [0, 0]
self.start_layer_scale_x = 1.0
self.start_layer_scale_y = 1.0
@ -1643,66 +1562,3 @@ class IMAGE_EDITOR_PLUS_OT_make_seamless(bpy.types.Operator):
app.refresh_image(context)
return {'FINISHED'}
class IMAGE_EDITOR_PLUS_OT_normal_map(bpy.types.Operator):
"""Apply settings"""
bl_idname = 'image_editor_plus.normal_map'
bl_label = "Normal Map"
scale: bpy.props.FloatProperty()
flip_x: bpy.props.BoolProperty()
flip_y: bpy.props.BoolProperty()
full_z: bpy.props.BoolProperty()
def execute(self, context):
scale = self.scale
flip_x = self.flip_x
flip_y = self.flip_y
full_z = self.full_z
pixels, hsl = app.get_image_cache()
if pixels is None:
return {'CANCELLED'}
selection = app.get_target_selection(context)
if selection:
target_hsl = hsl[selection[0][1]:selection[1][1],
selection[0][0]:selection[1][0]]
elif selection == []:
return {'CANCELLED'}
else:
target_hsl = hsl
target_width, target_height = target_hsl.shape[1], target_hsl.shape[0]
target_hsl = np.pad(target_hsl, ((1, 1), (1, 1), (0, 0)), 'edge')
new_pixels = np.zeros((target_height, target_width, 4))
nx = (target_hsl[1:target_height + 1, 0:target_width, 2]
- target_hsl[1:target_height + 1, 2:target_width + 2, 2]) * scale
ny = (target_hsl[0:target_height, 1:target_width + 1, 2]
- target_hsl[2:target_height + 2, 1:target_width + 1, 2]) * scale
nz = 1.0 / np.sqrt(nx * nx + ny * ny + 1.0)
nx *= nz
ny *= nz
new_pixels = np.dstack([
0.5 + (-0.5 if flip_x else 0.5) * nx,
0.5 + (-0.5 if flip_y else 0.5) * ny,
(0 if full_z else 0.5) + (1.0 if full_z else 0.5) * nz,
])
new_pixels = np.clip(new_pixels, 0, None)
if selection:
pixels[selection[0][1]:selection[1][1],
selection[0][0]:selection[1][0], 0:3] = new_pixels
else:
pixels[:,:,0:3] = new_pixels
img = app.get_target_image(context)
utils.write_pixels_to_image(img, pixels)
app.refresh_image(context)
return {'FINISHED'}

View File

@ -1,5 +1,5 @@
'''
Copyright (C) 2021 - 2024 Akaneyu
Copyright (C) 2021 - 2023 Akaneyu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -199,90 +199,6 @@ class IMAGE_EDITOR_PLUS_OT_scale_dialog(bpy.types.Operator):
row.column()
row.prop(self, 'reset', text='Reset', toggle=True)
def reset_canvas_size_properties(self, context):
if self.reset:
self.width = self.original_width
self.height = self.original_height
self.expand_from_center = False
self.use_background_color = False
self.reset = False
class IMAGE_EDITOR_PLUS_OT_change_canvas_size_dialog(bpy.types.Operator):
"""Change the canvas size"""
bl_idname = 'image_editor_plus.change_canvas_size_dialog'
bl_label = "Canvas Size"
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_canvas_size_properties)
width: bpy.props.IntProperty(name='Width',
min=1, options={'SKIP_SAVE'})
height: bpy.props.IntProperty(name='Height',
min=1, options={'SKIP_SAVE'})
expand_from_center: bpy.props.BoolProperty(name='Expand from Center', default=False)
use_background_color: bpy.props.BoolProperty(name='Use Background Color', default=False)
original_width: bpy.props.IntProperty()
original_height: bpy.props.IntProperty()
def invoke(self, context, event):
wm = context.window_manager
img = context.area.spaces.active.image
if not img:
return {'CANCELLED'}
width, height = img.size
self.original_width = width
self.original_height = height
self.width = width
self.height = height
return wm.invoke_props_dialog(self)
def execute(self, context):
width = self.width
height = self.height
if width < 1:
width = 1
if height < 1:
height = 1
bpy.ops.image_editor_plus.change_canvas_size('EXEC_DEFAULT', False,
width=width, height=height, expand_from_center=self.expand_from_center,
use_background_color=self.use_background_color)
return {'FINISHED'}
def draw(self, context):
layout = self.layout
row = layout.row()
row = layout.split(align=True)
row.alignment = 'RIGHT'
row.label(text='Width')
row.prop(self, 'width', text='')
row = layout.split(align=True)
row.alignment = 'RIGHT'
row.label(text='Height')
row.prop(self, 'height', text='')
row = layout.split(align=True)
row.column()
row.prop(self, 'expand_from_center')
row = layout.split(align=True)
row.column()
row.prop(self, 'use_background_color')
row = layout.split(align=True)
row.column()
row = layout.split(factor=0.7)
row.column()
row.prop(self, 'reset', text='Reset', toggle=True)
def preview_offset_properties(self, context):
if self.preview:
update_offset_properties(self, context)
@ -1253,117 +1169,6 @@ class IMAGE_EDITOR_PLUS_OT_make_seamless_dialog(bpy.types.Operator):
row.column()
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
def preview_normal_map_properties(self, context):
if self.preview:
update_normal_map_properties(self, context)
else:
img = app.get_target_image(context)
if img:
app.revert_image_cache(img)
app.refresh_image(context)
def reset_normal_map_properties(self, context):
if self.reset:
self.property_unset('scale')
self.property_unset('flip_x')
self.property_unset('flip_y')
self.property_unset('full_z')
update_normal_map_properties(self, context)
self.reset = False
def update_normal_map_properties(self, context):
if self.preview:
bpy.ops.image_editor_plus.normal_map('EXEC_DEFAULT', False,
scale=self.scale,
flip_x=self.flip_x,
flip_y=self.flip_y,
full_z=self.full_z)
class IMAGE_EDITOR_PLUS_OT_normal_map_dialog(bpy.types.Operator):
"""Generate a normal map"""
bl_idname = 'image_editor_plus.normal_map_dialog'
bl_label = "Normal Map"
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
update=preview_normal_map_properties)
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_normal_map_properties)
scale: bpy.props.FloatProperty(name='Scale', subtype='FACTOR',
min=0, soft_max=250.0, default=10.0, options={'SKIP_SAVE'},
update=update_normal_map_properties)
flip_x: bpy.props.BoolProperty(name='Flip X', default=False, options={'SKIP_SAVE'},
update=update_normal_map_properties)
flip_y: bpy.props.BoolProperty(name='Flip Y', default=False, options={'SKIP_SAVE'},
update=update_normal_map_properties)
full_z: bpy.props.BoolProperty(name='Full Range for Z', default=False, options={'SKIP_SAVE'},
update=update_normal_map_properties)
def invoke(self, context, event):
session = app.get_session()
wm = context.window_manager
img = app.get_target_image(context)
if not img:
return {'CANCELLED'}
app.cache_image(img, need_hsl=True)
layer = app.get_active_layer(context)
if layer:
session.cached_layer_location = layer.location[:]
update_normal_map_properties(self, context)
return wm.invoke_props_dialog(self)
def execute(self, context):
bpy.ops.image_editor_plus.normal_map('EXEC_DEFAULT', False,
scale=self.scale,
flip_x=self.flip_x,
flip_y=self.flip_y,
full_z=self.full_z)
return {'FINISHED'}
def cancel(self, context):
img = app.get_target_image(context)
if not img:
return {'CANCELLED'}
app.revert_image_cache(img)
app.clear_image_cache()
app.refresh_image(context)
def draw(self, context):
layout = self.layout
row = layout.split(align=True)
row.column()
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
layout.separator()
row = layout.split(align=True)
row.alignment = 'RIGHT'
row.label(text='Scale')
row.prop(self, 'scale', text='')
row = layout.split(align=True)
row.column()
row.prop(self, 'flip_x')
row = layout.split(align=True)
row.column()
row.prop(self, 'flip_y')
row = layout.split(align=True)
row.column()
row.prop(self, 'full_z')
row = layout.split(factor=0.7)
row.column()
row.prop(self, 'reset', text='Reset', toggle=True)
class IMAGE_EDITOR_PLUS_UL_layer_list(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
icon_value = 0
@ -1456,9 +1261,6 @@ class IMAGE_EDITOR_PLUS_MT_transform_menu(bpy.types.Menu):
op = layout.operator(IMAGE_EDITOR_PLUS_OT_scale_dialog.bl_idname, text='Scale...',
icon_value=get_icon_id('scale'))
op = layout.operator(IMAGE_EDITOR_PLUS_OT_change_canvas_size_dialog.bl_idname, text='Canvas Size...',
icon_value=get_icon_id('scale'))
class IMAGE_EDITOR_PLUS_MT_transform_layer_menu(bpy.types.Menu):
bl_idname = "IMAGE_EDITOR_PLUS_MT_transform_layer_menu"
bl_label = "Transform Layer"
@ -1518,8 +1320,8 @@ class IMAGE_EDITOR_PLUS_MT_adjust_menu(bpy.types.Menu):
layout.operator(IMAGE_EDITOR_PLUS_OT_adjust_color_curve_dialog.bl_idname, text='Color Curve...',
icon_value=get_icon_id('color_curve'))
layout.operator(IMAGE_EDITOR_PLUS_OT_replace_color_dialog.bl_idname, text="Replace Color...",
icon='COLOR')
#layout.operator(IMAGE_EDITOR_PLUS_OT_replace_color_dialog.bl_idname, text="Replace Color...",
# icon='COLOR')
class IMAGE_EDITOR_PLUS_MT_filter_menu(bpy.types.Menu):
bl_idname = "IMAGE_EDITOR_PLUS_MT_filter_menu"
@ -1543,9 +1345,6 @@ class IMAGE_EDITOR_PLUS_MT_filter_menu(bpy.types.Menu):
layout.operator(IMAGE_EDITOR_PLUS_OT_make_seamless_dialog.bl_idname, text='Make Seamless...',
icon_value=get_icon_id('filter'))
layout.operator(IMAGE_EDITOR_PLUS_OT_normal_map_dialog.bl_idname, text='Normal Map...',
icon_value=get_icon_id('filter'))
class IMAGE_EDITOR_PLUS_PT_select_panel(bpy.types.Panel):
bl_label = "Select"
bl_space_type = "IMAGE_EDITOR"
@ -1737,11 +1536,6 @@ class IMAGE_EDITOR_PLUS_PT_transform_panel(bpy.types.Panel):
op = row.operator(IMAGE_EDITOR_PLUS_OT_scale_dialog.bl_idname, text='Scale...',
icon_value=get_icon_id('scale'))
row = layout.row()
op = row.operator(IMAGE_EDITOR_PLUS_OT_change_canvas_size_dialog.bl_idname,
text='Canvas Size...',
icon_value=get_icon_id('scale'))
class IMAGE_EDITOR_PLUS_PT_transform_layer_panel(bpy.types.Panel):
bl_label = "Transform Layer"
bl_space_type = "IMAGE_EDITOR"
@ -1866,9 +1660,9 @@ class IMAGE_EDITOR_PLUS_PT_adjust_panel(bpy.types.Panel):
row.operator(IMAGE_EDITOR_PLUS_OT_adjust_color_curve_dialog.bl_idname, text='Color Curve...',
icon_value=get_icon_id('color_curve'))
row = layout.row()
row.operator(IMAGE_EDITOR_PLUS_OT_replace_color_dialog.bl_idname, text='Replace Color...',
icon='COLOR')
#row = layout.row()
#row.operator(IMAGE_EDITOR_PLUS_OT_replace_color_dialog.bl_idname, text='Replace Color...',
# icon='COLOR')
class IMAGE_EDITOR_PLUS_PT_filter_panel(bpy.types.Panel):
bl_label = "Filter"
@ -1907,7 +1701,3 @@ class IMAGE_EDITOR_PLUS_PT_filter_panel(bpy.types.Panel):
row = layout.row()
row.operator(IMAGE_EDITOR_PLUS_OT_make_seamless_dialog.bl_idname, text='Make Seamless...',
icon_value=get_icon_id('filter'))
row = layout.row()
row.operator(IMAGE_EDITOR_PLUS_OT_normal_map_dialog.bl_idname, text='Normal Map...',
icon_value=get_icon_id('filter'))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 KiB