Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor Image Optimization for Web/Mobile #3868

Closed
setanarut opened this issue Aug 3, 2020 · 9 comments
Closed

Poor Image Optimization for Web/Mobile #3868

setanarut opened this issue Aug 3, 2020 · 9 comments

Comments

@setanarut
Copy link

setanarut commented Aug 3, 2020

Your Godot version:
3.2
Issue description:
Poor image optimization for web.

All files over 100KB

I think it is possible to reduce these 179MB file to 50MB, with lossless (lossy lossless) compression.

Count: 216 file
Total size: 179MB

  • 13M ./tutorials/content/img/tree_sway.gif
  • 10M ./tutorials/physics/img/ragdoll_sim_part.gif
  • 8,0M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Part_5.zip
  • 8,0M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Finished.zip
  • 7,9M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Part_4.zip
  • 7,9M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Part_3.zip
  • 7,9M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Part_2.zip
  • 7,8M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Starter.zip
  • 7,8M ./tutorials/3d/fps_tutorial/files/Godot_FPS_Part_1.zip
  • 6,9M ./tutorials/3d/vertex_animation/img/scene.gif
  • 5,0M ./tutorials/3d/img/environment_hdr_autoexp.gif
  • 2,9M ./tutorials/physics/img/ragdoll_shape_adjust.gif
  • 2,4M ./tutorials/3d/img/spatial_material_proxfaade.gif
  • 2,0M ./tutorials/animation/img/skel2d25.gif
  • 1,9M ./tutorials/physics/img/ragdoll_joint_adjust.gif
  • 1,9M ./tutorials/animation/img/animtree5.gif
  • 1,7M ./tutorials/3d/img/baked_light_indirect.gif
  • 1,7M ./getting_started/step_by_step/files/dodge_assets.zip
  • 1,6M ./tutorials/3d/img/csg.gif
  • 1,5M ./tutorials/3d/img/environment_ambient_comparison.png
  • 1,4M ./tutorials/physics/img/area2d_override.gif
  • 1,4M ./tutorials/animation/img/skel2d21.gif
  • 1,4M ./tutorials/animation/img/animtree15.gif
  • 1,2M ./tutorials/3d/fps_tutorial/files/Godot_FPS_BlenderFiles.zip
  • 1,2M ./getting_started/step_by_step/img/instancing_multiball.gif
  • 1,1M ./tutorials/shading/files/2d_water_shader.zip
  • 1,1M ./tutorials/animation/img/tutovec_torso5.gif
  • 1,1M ./tutorials/animation/img/skel2d20.gif
  • 952K ./tutorials/3d/img/transforms_rotate2.gif
  • 904K ./tutorials/3d/img/transforms_rotate1.gif
  • 868K ./tutorials/3d/img/giprobe_voxel_reflections.png
  • 828K ./getting_started/step_by_step/img/dodge_preview.gif
  • 776K ./tutorials/animation/img/animation_simple.gif
  • 756K ./tutorials/3d/img/environment_hdr_bloom.png
  • 752K ./tutorials/3d/img/refprobe_blending.png
  • 748K ./tutorials/2d/img/paranim20.gif
  • 744K ./tutorials/3d/img/giprobe_interior.png
  • 744K ./tutorials/2d/img/paranim21.gif
  • 732K ./tutorials/animation/img/tutovec_torso1.gif
  • 720K ./tutorials/animation/files/gbot_resources.zip
  • 716K ./tutorials/animation/img/tutovec_torso2.gif
  • 700K ./tutorials/animation/img/animtree11.gif
  • 668K ./tutorials/3d/vertex_animation/img/all_motions.gif
  • 656K ./tutorials/3d/img/transforms_interpolate1.gif
  • 656K ./tutorials/2d/img/paranim9.gif
  • 644K ./tutorials/2d/img/paranim15.gif
  • 640K ./tutorials/animation/img/tuto_cutout_walk.gif
  • 632K ./tutorials/3d/vertex_animation/img/pivot.gif
  • 628K ./tutorials/plugins/gdnative/img/gdnative_cpp_animated.gif
  • 624K ./tutorials/3d/vertex_animation/img/wave.gif
  • 620K ./tutorials/3d/vertex_animation/img/twist.gif
  • 620K ./tutorials/3d/img/baked_light_comparison.png
  • 612K ./tutorials/animation/img/animtree7.gif
  • 608K ./tutorials/3d/vertex_animation/img/sidetoside.gif
  • 588K ./tutorials/2d/img/paranim18.gif
  • 580K ./tutorials/3d/fps_tutorial/img/PartThreeFinished.png
  • 568K ./tutorials/3d/img/transforms_interpolate2.gif
  • 564K ./tutorials/2d/img/paranim3.gif
  • 516K ./tutorials/3d/vertex_animation/img/all_motions_mask.gif
  • 516K ./tutorials/3d/img/transforms_gimbal.gif
  • 480K ./tutorials/animation/img/tutovec_torso4.gif
  • 480K ./tutorials/animation/img/gBot_pieces.png
  • 480K ./classes/class_visualserver.rst
  • 464K ./tutorials/2d/img/paranim8.gif
  • 456K ./tutorials/physics/img/ragdoll_sim_stop.gif
  • 440K ./tutorials/3d/img/environment_adjustments_bcs.png
  • 424K ./tutorials/misc/img/rotating_in_editor.gif
  • 408K ./tutorials/2d/img/paranim12.gif
  • 384K ./tutorials/3d/fps_tutorial/img/FinishedTutorialPicture.png
  • 368K ./tutorials/3d/fps_tutorial/img/PartFourFinished.png
  • 368K ./getting_started/step_by_step/files/ui_code_life_bar.zip
  • 360K ./tutorials/viewports/img/planet_example.png
  • 352K ./tutorials/3d/img/environment_dof_near.png
  • 352K ./tutorials/2d/img/paranim4.gif
  • 352K ./tutorials/2d/img/paranim11.gif
  • 348K ./tutorials/3d/fps_tutorial/img/PartFiveFinished.png
  • 344K ./tutorials/3d/img/giprobe_wrap.png
  • 344K ./tutorials/2d/img/paranim10.gif
  • 344K ./tutorials/2d/img/mesh2d1.png
  • 340K ./tutorials/physics/img/softbody_cloak_finish.png
  • 340K ./tutorials/2d/img/emission_mask_solid.gif
  • 336K ./tutorials/2d/img/paranim5.gif
  • 324K ./tutorials/3d/img/giprobe_ref_blending.png
  • 316K ./tutorials/misc/img/signals_shoot2.gif
  • 316K ./tutorials/animation/img/gBot_complete.png
  • 312K ./classes/class_projectsettings.rst
  • 308K ./tutorials/3d/img/refprobe_ssr.png
  • 304K ./tutorials/3d/img/environment_ssr.png
  • 304K ./tutorials/3d/img/environment_dof_far.png
  • 296K ./tutorials/3d/img/refprobe_setup.png
  • 296K ./tutorials/2d/img/paranim7.gif
  • 284K ./tutorials/2d/img/paranim1.gif
  • 284K ./tutorials/2d/img/mesh2d3.png
  • 280K ./tutorials/math/img/interpolation_monkey.gif
  • 280K ./tutorials/3d/img/giprobe_indirect_energy_result.png
  • 280K ./tutorials/3d/img/environment_mixed_blur.png
  • 280K ./tutorials/3d/img/environment_glow_layers.png
  • 280K ./getting_started/step_by_step/files/ui_gui_design.zip
  • 276K ./tutorials/vr/vr_starter_tutorial/img/starter_vr_tutorial_pistol.png
  • 272K ./tutorials/2d/img/emission_mask_directed_border.gif
  • 264K ./tutorials/3d/img/refprobe_boxcorrect.png
  • 260K ./tutorials/2d/img/mesh2d4.png
  • 256K ./tutorials/math/img/matrices_and_transforms/apply.xcf
  • 256K ./tutorials/2d/img/paranim6.gif
  • 252K ./tutorials/2d/img/paranim14.gif
  • 252K ./getting_started/step_by_step/img/editor_ui_intro_editor_05_3d_workspace.png
  • 248K ./tutorials/3d/img/environment_fog_depth_height.png
  • 248K ./tutorials/3d/img/environment_adjusments_custom_gradient.png
  • 244K ./getting_started/workflow/export/img/ios_export_add_dir.png
  • 240K ./tutorials/animation/img/animtree8.gif
  • 240K ./tutorials/3d/img/transforms_euler_himself.png
  • 232K ./tutorials/3d/img/giprobe_indirect.png
  • 232K ./tutorials/3d/img/environment_glow_bloom.png
  • 232K ./tutorials/3d/fps_tutorial/img/PartTwoFinished.png
  • 228K ./tutorials/3d/img/environment_glow_threshold.png
  • 228K ./tutorials/2d/img/mesh2d5.png
  • 224K ./tutorials/animation/img/animtree1.png
  • 216K ./tutorials/shading/img/vs_expression2.png
  • 212K ./tutorials/vr/vr_starter_tutorial/img/starter_vr_tutorial_sword.png
  • 212K ./tutorials/shading/img/vs_boolean.gif
  • 212K ./tutorials/math/img/bezier_cubic_points.gif
  • 212K ./tutorials/2d/img/paranim2.gif
  • 208K ./tutorials/animation/img/skel2d7.png
  • 208K ./tutorials/3d/img/environment_glow1.png
  • 208K ./tutorials/2d/img/emission_mask_border.gif
  • 208K ./development/cpp/img/architecture_diagram.jpg
  • 204K ./tutorials/vr/vr_starter_tutorial/img/starter_vr_tutorial_hands.png
  • 204K ./tutorials/shading/img/vs_expression.gif
  • 196K ./tutorials/animation/img/skel2d6.png
  • 196K ./tutorials/3d/img/spatial_material25.png
  • 192K ./tutorials/plugins/gdnative/img/connect_button_signal.gif
  • 192K ./tutorials/math/img/matrices_and_transforms/scale.xcf
  • 192K ./tutorials/animation/img/tuto_cutout9.png
  • 188K ./getting_started/step_by_step/img/editor_ui_intro_editor_06_3d_workspace.png
  • 188K ./development/cpp/configuring_an_ide/img/code_blocks_file_new_project.png
  • 184K ./tutorials/gui/img/container_example.gif
  • 180K ./tutorials/3d/files/gridmap_demo.zip
  • 176K ./tutorials/3d/img/environment_glow_layers2.png
  • 172K ./tutorials/assetlib/img/assetlib_asset.png
  • 172K ./tutorials/3d/img/gridmap_menu.png
  • 172K ./tutorials/3d/img/environment_ambient2.png
  • 168K ./tutorials/content/img/tree_base.png
  • 168K ./tutorials/3d/img/spatial_material23.png
  • 168K ./tutorials/3d/img/normal_bias.png
  • 164K ./tutorials/math/img/matrices_and_transforms/rotate3.xcf
  • 164K ./tutorials/3d/img/refprobe_center_gizmo.png
  • 164K ./tutorials/3d/img/gridmap_main.png
  • 164K ./tutorials/3d/img/environment_ssao.png
  • 164K ./tutorials/3d/img/baked_light_bounds.png
  • 164K ./tutorials/3d/fps_tutorial/img/PartOneFinished.png
  • 160K ./tutorials/misc/img/motion_normal.gif
  • 160K ./getting_started/workflow/export/img/icon_result.png
  • 156K ./tutorials/plugins/gdnative/img/add_main_script.gif
  • 152K ./tutorials/plugins/gdnative/img/save_gdns.gif
  • 152K ./tutorials/math/img/matrices_and_transforms/shear.xcf
  • 152K ./tutorials/math/img/matrices_and_transforms/3d-identity.xcf
  • 152K ./tutorials/math/img/bezier_quadratic_points2.gif
  • 152K ./tutorials/gui/img/godot_containers.png
  • 148K ./tutorials/misc/img/state_design_complete.gif
  • 148K ./tutorials/misc/img/signals_shoot1.gif
  • 148K ./img/tween_cheatsheet.png
  • 148K ./getting_started/step_by_step/img/out.gif
  • 144K ./tutorials/shading/img/intro_to_shaders_water_thumbnail.png
  • 144K ./getting_started/workflow/export/img/ios_export_set_path.png
  • 136K ./tutorials/assetlib/img/assetlib_website.png
  • 136K ./tutorials/2d/img/movement_rotate1.gif
  • 136K ./classes/class_physicsserver.rst
  • 132K ./tutorials/plugins/editor/img/visual_shader_plugins_start.png
  • 132K ./tutorials/misc/img/motion_jitter.gif
  • 132K ./tutorials/3d/img/environment_ssao2.png
  • 132K ./tutorials/3d/img/environment_glow_bicubic.png
  • 128K ./tutorials/animation/img/skel2d13.png
  • 128K ./tutorials/2d/img/movement_rotate2.gif
  • 128K ./development/cpp/configuring_an_ide/img/code_block_use_tab_character.png
  • 128K ./classes/class_physics2dserver.rst
  • 124K ./tutorials/shading/your_first_shader/img/dark-water.png
  • 124K ./tutorials/shading/img/vs_fresnel.png
  • 124K ./tutorials/physics/files/using_area_2d.zip
  • 124K ./tutorials/misc/img/motion_stutter.gif
  • 124K ./tutorials/math/img/matrices_and_transforms/identity-grid.xcf
  • 124K ./tutorials/2d/img/movement_click.gif
  • 124K ./getting_started/workflow/export/img/icon_export_settings.png
  • 124K ./community/contributing/img/best_practices7.png
  • 124K ./classes/class_control.rst
  • 120K ./tutorials/viewports/img/stretch_2d_expand.gif
  • 120K ./tutorials/shading/your_first_shader/img/fresnel.png
  • 120K ./tutorials/shading/img/vs_if.png
  • 120K ./tutorials/animation/img/skel2d11.png
  • 116K ./tutorials/physics/img/k2d_platform.gif
  • 116K ./tutorials/math/img/matrices_and_transforms/translate.xcf
  • 116K ./tutorials/animation/img/skel2d8.png
  • 116K ./tutorials/animation/img/skel2d12.png
  • 116K ./tutorials/animation/img/skel2d10.png
  • 112K ./tutorials/shading/your_first_shader/img/wave1.png
  • 112K ./tutorials/shading/your_first_shader/img/specular-toon.png
  • 112K ./tutorials/shading/your_first_shader/img/rim.png
  • 112K ./tutorials/shading/your_first_shader/img/plastic.png
  • 112K ./tutorials/physics/img/k2d_bullet_bounce.gif
  • 112K ./tutorials/math/img/matrices_and_transforms/identity-origin.xcf
  • 112K ./tutorials/math/img/matrices_and_transforms/apply.png
  • 112K ./tutorials/math/img/interpolation_follow.gif
  • 112K ./getting_started/workflow/export/img/icon_project_settings.png
  • 112K ./classes/class_os.rst
  • 112K ./classes/class_basematerial3d.rst
  • 108K ./tutorials/3d/img/spatial_material21.png
  • 108K ./tutorials/3d/img/spatial_material17.png
  • 108K ./tutorials/3d/img/gridmap_export.png
  • 108K ./tutorials/3d/img/csg_custom_mesh.png
  • 108K ./getting_started/step_by_step/img/instancing_multiball.png
  • 108K ./getting_started/step_by_step/files/autoload.zip
  • 104K ./tutorials/shading/your_first_shader/img/albedo.png
  • 104K ./tutorials/shading/img/intro_to_shaders_water_godot_project.png
  • 104K ./tutorials/misc/img/state_design_node_setup.png
  • 104K ./tutorials/math/img/matrices_and_transforms/rotate1.xcf
  • 104K ./tutorials/animation/img/animtree16.png
  • 104K ./tutorials/3d/img/light_spot.png
@clayjohn
Copy link
Member

clayjohn commented Aug 3, 2020

Do you know of a better image compressor than pngquant? That is the one used for the images in the docs right now.

@setanarut
Copy link
Author

setanarut commented Aug 3, 2020

Do you know of a better image compressor than pngquant? That is the one used for the images in the docs right now.

You are right, lossless compression is done for PNGs. but lossless compression is required for a small number of PNG images like this(the details should not be lost.); baked_light_comparison.png

Images like transforms_euler_himself.png can be compressed with loss, the human eye cannot distinguish. Especially images with few colors and shapes can be highly compressed.

87KB (lossy compression)

transforms_euler_himself kopyası

242KB (original)

transforms_euler_himself

How much an image can be compressed depends on many factors, size, number of colors, number of frames. and compressing hundreds of them automatically with a script is not easy. Must be done while creating images/gifs. I use this ffmpeg shell method to convert video to high quality compressed gif.

video2gif() {
    if [[ "$1" == "-h" ]]
        then
        echo "usage: video2gif input.mov output.gif width FPS"
        return 1
        else
        palette="/tmp/palette.png"
        filters="fps=$4,scale=$3:-1:flags=bicubic"

        ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
        ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
    fi
}

@setanarut setanarut reopened this Aug 4, 2020
@NathanLovato
Copy link
Contributor

I would recommend using looping videos instead of gifs altogether, you get both much higher visual fidelity and lower sizes with h264 encoding, and you have widespread support for the codec in browsers.

@Calinou is using looping videos instead of gifs an option in the docs?

@Calinou
Copy link
Member

Calinou commented Sep 6, 2020

@NathanLovato I haven't checked the state of using videos in Sphinx, but it should be feasible (even with an extension). Just make sure to use the muted autoplay attributes on the video element so that the video can play automatically (muted is required for autoplay to work in modern browsers).

@NathanLovato
Copy link
Contributor

Yes, there's also another attribute you need for iOS. I have had to look into that for our website some time ago. Good to know, let's keep that in mind.

@setanarut
Copy link
Author

setanarut commented Sep 7, 2020

There are only a few gifs, the problem is not that gifs take up space. It is the use of unnecessary gif and zip files. And the images are not well compressed. IMO, I think documents and tutorial pages should be stored in separate github repositories and on separate web pages.

@Calinou
Copy link
Member

Calinou commented Sep 7, 2020

@hazarek We already plan to remove ZIP files from this repository and store them in the godot-demo-projects repository instead. See this proposal for more information.

@setanarut
Copy link
Author

@hazarek We already plan to remove ZIP files from this repository and store them in the godot-demo-projects repository instead. See this proposal for more information.

Not enough. Manuals, API References, and Tutorials are different concepts. I am talking about developing these in separate branches. It should not be published on a single page.

@NathanLovato
Copy link
Contributor

NathanLovato commented Sep 7, 2020

We're going to remove step-by-step tutorials from the docs and move towards focusing on a reference manual (with some practical examples).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants