Set Image output from extension

I compile it with Git.
may be an old version of AppInventor source: 16/04/2014...
should i download a new one ?

Yes. Use the latest source. Helper blocks is a fairly new feature.

with new AI version, i have a compil error !:

error: Property EditImage.Image has no category.

@DesignerProperty()
    @SimpleProperty(description = "Sets the Image ")
    public void Image(String filePath) {
		Bitmap bitmap=DefineImage(filePath);
		this.globalBitmapSet=true;
	}

(without compil error with old version...)

Show the entire error and the current code. In errors, it shows the number of the java code line in which the error occurs.

Aaah, yes. In the new version of aap inventor, you must assign a category to each property. You need to determine whether the property affects appearance or behavior.

in DesignerProperty, you need to specify the editortype?

like

@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "xxxxx")

init:

CommonUtils:

CommonConstants:
[mkdir] Created dir: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\CommonConstants
[javac] Compiling 45 source files to D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\CommonConstants
[javac] Creating empty D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\CommonConstants\com\google\appinventor\components\common\package-info.class
[jar] Building jar: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\build\components\CommonConstants.jar
[jar] Building jar: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\build\components\CommonConstants-gwt.jar

AnnotationProcessors:
[mkdir] Created dir: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AnnotationProcessors
[javac] Compiling 45 source files to D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AnnotationProcessors
[javac] Note: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\src\com\google\appinventor\components\scripts\ComponentProcessor.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] Creating empty D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AnnotationProcessors\com\google\appinventor\components\annotations\androidmanifest\package-info.class
[javac] Creating empty D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AnnotationProcessors\com\google\appinventor\components\annotations\package-info.class
[javac] Creating empty D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AnnotationProcessors\com\google\appinventor\components\scripts\package-info.class
[copy] Copying 22 files to D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AnnotationProcessors
[jar] Building jar: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\AnnotationProcessors.jar

AndroidRuntime.uptodate:

AndroidRuntime:
[mkdir] Created dir: D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AndroidRuntime
[javac] Compiling 376 source files to D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build\classes\AndroidRuntime
[javac] error: Property EditImage.Image has no category.
[javac] error: Property EditImage.OutputImagePath has no category.
[javac] Note: Wrote file file:/D:/Documents/programmation/App%20inventor/extensions/creation%20extensions%20AI/appinventor-sources-master/appinventor/components/build/classes/AndroidRuntime/simple_components.json
[javac] Note: Wrote file file:/D:/Documents/programmation/App%20inventor/extensions/creation%20extensions%20AI/appinventor-sources-master/appinventor/components/build/classes/AndroidRuntime/simple_components.txt
[javac] Note: Wrote file file:/D:/Documents/programmation/App%20inventor/extensions/creation%20extensions%20AI/appinventor-sources-master/appinventor/components/build/classes/AndroidRuntime/simple_components_build_info.json
[javac] Note: Wrote file file:/D:/Documents/programmation/App%20inventor/extensions/creation%20extensions%20AI/appinventor-sources-master/appinventor/components/build/classes/AndroidRuntime/AutogeneratedOdeMessages.java
[javac] Note: Wrote file file:/D:/Documents/programmation/App%20inventor/extensions/creation%20extensions%20AI/appinventor-sources-master/appinventor/components/build/classes/AndroidRuntime/ComponentsTranslation.java
[javac] 2 errors

BUILD FAILED
D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\build.xml:73: The following error occurred while executing this line:
D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\build.xml:230: The following error occurred while executing this line:
D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\build-common.xml:131: Compile failed; see the compiler error output for details.

Total time: 10 seconds
Picked up _JAVA_OPTIONS: -Xmx1024m

EditImage.txt (29,5 Ko)

No, it's not about the editor type, but about the property categories.

I don't remember exactly, and I have no way to check now. Something like: propertyCategory = behavior

@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING,defaultValue = "no Image")
    @SimpleProperty(description = "Sets the Image ")
    public void Image(String filePath) {
		Bitmap bitmap=DefineImage(filePath);
		this.globalBitmapSet=true;
	}

same compil error

Open the java source of any component and find something similar to what I wrote above

@SimpleProperty(category = PropertyCategory.BEHAVIOR, description = "Sets the Image ")

That's it !

but new version doesn't solve my problem:
@Asset({".png", ".jpeg", ".jpg"}) have compil error...

@DesignerProperty()
    @SimpleProperty(category = PropertyCategory.BEHAVIOR, description = "Sets the Image ")
    public void Image(@Asset({".png", ".jpeg", ".jpg"}) String filePath) {
		Bitmap bitmap=DefineImage(filePath);
		this.globalBitmapSet=true;
	}

D:\Documents\programmation\App inventor\extensions\creation extensions AI\appinventor-sources-master\appinventor\components\src\jml\EditImage.java:75: error: cannot find symbol
[javac] public void Image(@Asset({".png", ".jpeg", ".jpg"}) String filePath) {
[javac] ^
[javac] symbol: class Asset
[javac] location: class EditImage
[javac] 1 error

Oh no ! sorry ! i forgot ```
import com.google.appinventor.components.annotations.Asset;

so it works...thanks

where are you writing your code? Why need to import package manually?
normally the IDE will do this work.

I use Visual Studio Code to write my code and use Git to compil it.

as explain here

is there a easier way ?

I updated my first post.
correcting some small bugs.
and take into account all posts

This thread up to now was about fixing the bugs in your extension
Now it looks like you are close to publish it
Please start a new thread in category Extensions to present your app considering

Also let me suggest some cosmetical changes
your extension is about images, so the word image is unnecessary to use in method names

For example
OutputImagePath --> OutputPath
ImagePath --> OutputPath
These are the setter and getter properties of the output path, so the property name should be the same and not different

Image --> InputPath
BlurImage --> Blur
BlurImageByColumn --> BlurByColumn
Etc
The methods ImgHeight and ImgWidth should better be properties
ImgHeight --> Height
ImgWidth --> Width
There still is a spelling error for
SetBrigthness --> SetBrightness

Taifun

I also think that the extension needs to be adapted to work in the companion. I mean handling images from assets in the companion.

ok, but i don't know what is the problem with companion...it told me it can't load file in assets, but i don't know why...

Check the App Inventor sources, how it is done there... for example the image component...

Taifun